Sending email with HTML body in ASP.Net and List of SMTP host

TO Run this program you need 
1> A email id
2>Password of email id
3>Your SMTP host (ex-for gmail- smtp.gmail.com)


Now you can use this function given----


add these name space--

using System.Net.Mail;
using System.Web;

copy and paste this function and use it easily.

 public static bool SendMail(string fromAddress, string toAddress, string subject, string body)
        {

            MailMessage msgMail = new MailMessage(fromAddress, toAddress, subject, body);
            msgMail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp host name";
            smtp.UseDefaultCredentials = true;
            smtp.Credentials = new System.Net.NetworkCredential("your email id", "password");

            try
            {
                smtp.Send(msgMail);
                return true;
            }

            catch
            {

                return false;
            }
        }

OR YOu CAN TRY....

MailMessage mail = new MailMessage();
            mail.To.Add("[email protected]");
            mail.From = new MailAddress("[email protected]");
            mail.Subject = "Test Email";
            string Body = "<b>Welcome Varanasiworld!!</b>";
            mail.Body = Body;
            mail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.Credentials = new System.Net.NetworkCredential("EMAIL", "Pass");
            smtp.EnableSsl = true;
            smtp.Send(mail);

Some SMTP Hosts::---

A - F

  • Amaze.net.au: mail.amaze.net.au
  • Ameritech DSL: mailhost.col.ameritech.net
  • aol: aol.com
  • aol: za.mx.aol.com
  • aol: zb.mx.aol.com
  • aol: zc.mx.aol.com
  • AT&T: smtp1.attglobal.net
  • AT&T: mailhost.worldnet.att.net
  • AT&T WorldNet: mailhost.att.net
  • AT&T WorldNet: mailhost.worldnet.att.net
  • Australink.net: mail.australink.net
  • bellatlantic.net: smtpout.bellatlantic.net
  • Bluelight.com: smtp.mail.yahoo.com
  • BlueYonder: smtp.blueyonder.co.uk
  • Bondinet.com: mail1.oznet.net.au
  • Breathe: mailhost.breathemail.net
  • bright.net: mail.bright.net
  • Bt Click: mail.btclick.com
  • Bt Connect: smtp.btconnect.com
  • BT Internet: mail.btinternet.com
  • BT Openworld: mail.btopenworld.com
  • BusinessServe: smtp.businessserve.co.uk
  • Cableinet: smtp.blueyonder.co.uk
  • Claranet: relay.clara.net
  • Comcast: smtp.comcast.net
  • CompuServe 2000: smtp.cs.com
  • CompuServe Classic: mail.compuserve.com
  • Cox (east): smtp.east.cox.net
  • Cox (west): smtp.west.cox.net
  • CWCom: smtp.ntlworld.com
  • DCAnet: postoffice.dca.net
  • Demon: post.demon.co.uk
  • Earthlink.net: smtp.earthlink.net
  • Easynet: smtp.easynet.co.uk
  • ee.net: mail.ee.net
  • Freeinet.com: mail.ma.freei.net
  • Freeserve/Wanadoo: smtp.freeserve.co.uk
  • Freeserve: smtp.freeserve.net
  • Free-Online: relay.free-online.co.uk

G - L

  • Gateway: smtp.gateway.net
  • Genie: mail.genie.co.uk
  • Greenbank.net.au: mail.greenbank.net.au
  • Hotkey.net.au: mail.hotkey.net.au
  • ibm.net: smtp1.ibm.net
  • IC24: smtp.ic24.net
  • icdc.com: mailout.icdc.com
  • INFOLINK.com: mail.nfolink.com
  • Interlink: mail.your-net.com
  • Inweb Networks: post.inweb.co.uk
  • IronNet: mail.iron.net
  • iwayNET: smtp.iwaynet.net
  • Jade Inc.: mail.jadeinc.com
  • Lineone: smtp.lineone.net
  • Log on America: mail.loa.com
  • Logicworld.com.au: mail.logicworld.com.au
  • Lycos: smtp.lycos.co.uk

M - R

  • Madasafish: smtp.madasafish.com
  • MegaNet: smtp.meganet.net
  • Microsoft's MSN: smtp.email.msn.com
  • MidOhio.net: mail.midohio.net
  • MindSpring: smtp.mindspring.com
  • MindSpring: mail.mindspring.com
  • Mistral: smtp.mistral.co.uk
  • MSN.com: smtp.email.msn.com
  • MSN.DSL: secure.smtp.email.msn.com
  • NamesToday: smtp.namestoday.ws
  • netcom.com: smtp.ix.netcom.com
  • netreach.net: smtp.netreach.net
  • Netscapeonline: mailhost.netscapeonline.co.uk
  • NetSet: mail.netset.com
  • NetWalk.com: mail.netwalk.com
  • netzero.net: smtp.netzero.net
  • nextek.net: mail.nextek.net
  • Nildram: smtp.nildram.co.uk
  • nni.com: nni.com
  • Northstar Data Systems: mail.nn.net
  • NTL World: smtp.ntlworld.com
  • OneTel: mail.onetel.net.uk
  • OneTel: mail.onetel.com
  • On-Ramp: mail.marion.net
  • Ozemail.com.au: smtp.ozemail.com.au
  • peoplepc: mail.peoplepc.com
  • Phone Co-op: smtp-1.opaltelecom.net
  • Pipex: smtp.dial.pipex.com
  • Plus Net: relay.plus.net
  • Prodigy: smtp.prodigy.net
  • Purplenet: smtp.purplenet.co.uk
  • rcn.com: smtp.rcn.com
  • redbird.net: mail.redbird.net
  • RichNet: mail.richnet.net
  • Road Runner (Insight Communications): smtp-server.insight.rr.com
  • Road Runner (Time Warner): smtp-server.columbus.rr.com
  • Road Runner (Time Warner): smtp-server.nc.rr.com

S - Z

  • Screaming.Net: smtp.tiscali.co.uk
  • Spire: mail.spire.com
  • Supanet: smtp.supanet.com
  • Telewest: smtp.blueyonder.co.uk
  • Telocity: mail.telocity.com
  • Tesco: smtp.tesco.net
  • Tesconet: mail.tesco.net
  • Tiscali: smtp.tiscali.co.uk
  • Totalise: mail.totalise.co.uk
  • TPG.com.au: mail.tpg.com.au
  • TTLC: mail.ttlc.net
  • UKGateway: smtp.ukgateway.net
  • uu.net: uu.net
  • V 21: smtp.v21.co.uk
  • Verizon: smtp.verizon.net
  • Virgin: smtp.virgin.net
  • Vispa: mail.vispa.com
  • voicenet.com: mail.voicenet.com
  • Waitrose: smtpmail.waitrose.com
  • Wanadoo: smtp.wanadoo.fr
  • Webcom: smtp.webcom.com
  • Which Online: mail.which.net
  • Wide Open West: smtp.mail.wowway.com
  • Wide Open West (users with @wideopenwest.com):smtp.mail.wideopenwest.com
  • Worldonline: smtp.tiscali.co.uk
  • Yahoo: smtp.mail.yahoo.com
  • Yahoo: smtp.sbcglobal.yahoo.com
Next Recommended Reading Sending Email In ASP.NET MVC