email - how to send mail from .net? -


i want send email .net application. please tell me steps sending email.

start exploring system.net.mail.smtpclient type in .net. type offers overload method send.

look here


    public static void createtestmessage1(string server, int port)     {         string = "jane@contoso.com";         string = "ben@contoso.com";         string subject = "using new smtp client.";         string body = @"using new feature, can send e-mail message application easily.";         mailmessage message = new mailmessage(from, to, subject, body);         smtpclient client = new smtpclient(server, port);         // credentials necessary if server requires client          // authenticate before send e-mail on client's behalf.         client.credentials = credentialcache.defaultnetworkcredentials;          try         {             client.send(message);         }         catch (exception ex)         {             console.writeline("exception caught in createtestmessage1(): {0}",                   ex.tostring());         }     } 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -