I want to send email from windowsform and the bodypart of the email should contain htmlpage . I can send the plain text but not html
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("from add");
mail.To.Add("toadd");
mail.Subject = "Test Mail";
mail.IsBodyHtml = true;
string htmlBody;
htmlBody = "<b>Welcome to CodeDigest.Com</b>";
mail.Body = htmlBody;
SmtpServer.Port = 25;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true;
// MessageBox.Show("will send");
SmtpServer.Send(mail);
MessageBox.Show("mail Send");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}

New Topic/Question
Reply




MultiQuote




|