c# how to add smtp hotmail account to send mail

Posted by leventkalayz on Stack Overflow See other posts from Stack Overflow or by leventkalayz
Published on 2012-03-24T11:23:10Z Indexed on 2012/03/24 11:30 UTC
Read the original article Hit count: 209

Filed under:
|
|

I wrote some codes so as to send e mail but I can only send mail from gmail account to gmail account also, I want to use hotmail accounts how can i do it? thanks It is

SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

        mail.From = new MailAddress("[email protected]");


        mail.To.Add("[email protected]");


        mail.Subject = "Test Mail - 1";


        mail.IsBodyHtml = true;


        string htmlBody;


        htmlBody = "Write some HTML code here";


        mail.Body = htmlBody;


        SmtpServer.Port = 587;


        SmtpServer.Credentials = new System.Net.NetworkCredential("[email protected]", "mypassword");


        SmtpServer.EnableSsl = true;


        SmtpServer.Send(mail);

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET