Knowledgebase: Downloads
ASP.NET sample send mail code
Posted by Premium Reseller on 06 February 2013 09:32 AM

Download zip file, extract and upload to website home folder, configure smtp account in web.config file.

Extracts of send mail code:

using System.Net.Mail;


MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("");
mailMessage.To.Add(new MailAddress(txtEmail.Text));

string emailBody = "Test Send Mail";
mailMessage.IsBodyHtml = true;
mailMessage.Subject = "Asp.Net Send mail";
mailMessage.Body = emailBody;

SmtpClient smtpClient = new SmtpClient();
lblInfo.Text = "Email has been sent";

Attachments (3.41 KB)
(2 vote(s))
This article was helpful
This article was not helpful