Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub
السلام عليكم:
لا أعلم مالذي جعل الكود يطير من هنا؟؟؟؟؟ مع أني قمت بوضعه ولكن لا أعلم مالذي يحصل معي في هذا الموقع فكلما أضع مشاركة إما لا أجدها أو أنها تظهر بشكل ناقص
عموما أعتذر عن ظهور الكود بهذه الطريقة أو عدم ظهوره أصلا....
وهذه إعادة كاملة للموضوع :
أولا نقوم بكتابة هذا الكود في أول سطر وقبل أي كود آخر في الصفحة
Imports System.Net.Mail
ومن ثم هذا إجراء يقوم بإرسال ميل من VB.Net 2008 حصرا ..قم باستدعاء هذا الإجراء بعد إدخال التعديلات المناسبة :
Private Sub SendEmail()
Dim mail As New System.Net.Mail.MailMessage()
Dim msgBody As String = String.Empty
Dim smtp As System.Net.Mail.SmtpClient = New SmtpClient()
Dim files As System.Net.Mail.Attachment = New Attachment("F:\attach.txt")
mail.From = New System.Net.Mail.MailAddress("type your email here ", "type your name here")
mail.[To].Add("type the email you want to send for")
mail.Subject = "type the subject here"
mail.Body = "type your message body here"
mail.IsBodyHtml = True
smtp.Host = "smtp.gmail.com"
smtp.Port = 25
smtp.EnableSsl = True
mail.Attachments.Add(files)
smtp.Credentials = New System.Net.NetworkCredential("type your email here", "type the password here")
Try
smtp.Send(mail)
MsgBox("the message has been sent successfully")
Catch ex As System.Exception
MsgBox(ex.Message)
End Try
End Subشكرا على الردود المشجعة!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
شكرا" يا ديما ..... و لكن عند سطر SMTP.Send(mail) يعطي :Failure sending mail
يا ترى ليه
mesh sha3'al ma3aia mesh 3aref leeh
ana 3'aiart gmail le yahoo ot yahoomail beideny ya 2amaa beideny Failure sending mail ya 2ama Time Out