Dim Fromemail As String = dt.Rows(0)("email").ToString() Dim password As String = dt.Rows(0)("password").ToString() Dim mailsubject As String = dt.Rows(0)("title").ToString() Dim mailbody As String = dt.Rows(0)("body").ToString() Dim portno As Integer = dt.Rows(0)("portno") Dim mail As MailMessage = New MailMessage mail.From = New MailAddress(Fromemail) mail.To.Add(New MailAddress(Toemail)) mail.Subject = mailsubject mail.Body = mailbody mail.IsBodyHtml = True Dim client As SmtpClient = New SmtpClient("smtp.gmail.com", portno) client.EnableSsl = True client.UseDefaultCredentials = False client.Credentials = New System.Net.NetworkCredential(Fromemail, password) Try client.Send(mail) MessageBox.Show("Email Sent Successfully") Catch ex As Exception MessageBox.Show("Sending email failed. Please Try again") End Try
mail.IsBodyHtml = True
mail.Body = mailbody.Replace("\n", "<br />");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)