using System.Net.Mail;
Example:
try
{
string messageHtml = @"
<h1>Hello</h1>
<p>Your account has been created</p>
<a href=""http://www.compnay.com?confirm.aspx?guid=1234"">Click here to confirm your email</a>
";
MailMessage message = new MailMessage("from@company.com", "to@company.com");
message.IsBodyHtml = true;
message.Body = messageHtml;
message.Subject = "Hi there";
SmtpClient smtpClient = new SmtpClient("auth.smtp.company.com");
smtpClient.Send(message);
this.Response.Redirect("Contact.aspx?action=MessageSent");
}
catch
{
throw new InvalidOperationException("Unable to send an email");
}
No comments:
Post a Comment