how 2 send pic with mail plz help!
-
i m using Smtp for sending mail. I m getting body text from an html editor. This editor uses webbrowser control. Problem is this, when i put an image on the webbrowser control and send it to a mailing address it don't show the pic but all the test is ok. here's the code i use. Dim MailObj As Net.Mail.MailMessage = New Net.Mail.MailMessage() MailObj.To.Add("sampleemailaddress@exampledomain.com") MailObj.From = New Net.Mail.MailAddress("myemailaddress@somedomain.com", "King") mailObj.Priority = Net.Mail.MailPriority.Normal MailObj.Subject = "This is test mail" mailObj.Body = WebBrowser1.DocumentText Dim smtpcli As Net.Mail.SmtpClient = New Net.Mail.SmtpClient("smtp.gmail.com", 587) smtpcli.EnableSsl = True smtpcli.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtpcli.Credentials = New Net.NetworkCredential("someemailaddress@gmail.com", "password") Try smtpcli.Send(MailObj) MsgBox("Email successfully delivered.") Catch ex As Exception MsgBox(ex.ToString()) End Try Thx in advance for any help.....
King
-
i m using Smtp for sending mail. I m getting body text from an html editor. This editor uses webbrowser control. Problem is this, when i put an image on the webbrowser control and send it to a mailing address it don't show the pic but all the test is ok. here's the code i use. Dim MailObj As Net.Mail.MailMessage = New Net.Mail.MailMessage() MailObj.To.Add("sampleemailaddress@exampledomain.com") MailObj.From = New Net.Mail.MailAddress("myemailaddress@somedomain.com", "King") mailObj.Priority = Net.Mail.MailPriority.Normal MailObj.Subject = "This is test mail" mailObj.Body = WebBrowser1.DocumentText Dim smtpcli As Net.Mail.SmtpClient = New Net.Mail.SmtpClient("smtp.gmail.com", 587) smtpcli.EnableSsl = True smtpcli.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtpcli.Credentials = New Net.NetworkCredential("someemailaddress@gmail.com", "password") Try smtpcli.Send(MailObj) MsgBox("Email successfully delivered.") Catch ex As Exception MsgBox(ex.ToString()) End Try Thx in advance for any help.....
King
-
i m using Smtp for sending mail. I m getting body text from an html editor. This editor uses webbrowser control. Problem is this, when i put an image on the webbrowser control and send it to a mailing address it don't show the pic but all the test is ok. here's the code i use. Dim MailObj As Net.Mail.MailMessage = New Net.Mail.MailMessage() MailObj.To.Add("sampleemailaddress@exampledomain.com") MailObj.From = New Net.Mail.MailAddress("myemailaddress@somedomain.com", "King") mailObj.Priority = Net.Mail.MailPriority.Normal MailObj.Subject = "This is test mail" mailObj.Body = WebBrowser1.DocumentText Dim smtpcli As Net.Mail.SmtpClient = New Net.Mail.SmtpClient("smtp.gmail.com", 587) smtpcli.EnableSsl = True smtpcli.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network smtpcli.Credentials = New Net.NetworkCredential("someemailaddress@gmail.com", "password") Try smtpcli.Send(MailObj) MsgBox("Email successfully delivered.") Catch ex As Exception MsgBox(ex.ToString()) End Try Thx in advance for any help.....
King
Just declare a MailAttachment object give the path of Image to its constructor and then Add it into the Attachment collection of your Mail Message object e.g.
Dim imgAt As New MailAttachment("ImagePath") MailObj.Attachments.Add(imgAt)
Good Luck !
AliAmjad(MCP) First make it Run THEN make it Run Fast!