How to send mail in asp.net

[Invoke]
public void SendEmail(string subject, string text, string toAddress,
string fromAddress)
{
MailMessage message = new MailMessage();
SmtpClient server = new SmtpClient(“localhost”);
message.From = new MailAddress(fromAddress);
message.Subject = subject;
message.Body = text;
message.IsBodyHtml = true;
message.To.Add(new MailAddress(toAddress));
server.Timeout = 10000;
server.Send(message);
}
Next Recommended Reading How we can send async mail using ASP.Net