using System.Web.Mail; string body = "Hi this is a sample mail"; MailMessage m = new MailMessage(); m.Body = body; m.BodyFormat = MailFormat.Html; m.To = "abc@gmail.com"; m.From = "info@abc.com"; m.Subject = "Sample Mail"; m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //User name on website from where you send a mail. m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username" ); //Password on website from where you send a mail. m.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","password"); SmtpMail.SmtpServer = "www.abc.com"; try { SmtpMail.Send(m); Response.Write("Email has been send"); } catch (Exception ex) { Response.Write(ex.Message); }