Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Send Hotmail, Outlook, Office365 Email using SMTP C# .NET

SmtpClient SmtpServer = new SmtpClient("smtp.office365.com");
var mail = new MailMessage();
mail.From = new MailAddress("youremail@hotmail.com");
mail.To.Add("to@gmail.com");
mail.Subject = "Test Mail - 1";
mail.IsBodyHtml = true;
string htmlBody;
htmlBody = "Write some HTML code here";
mail.Body = htmlBody;
SmtpServer.Port = 587;
SmtpServer.UseDefaultCredentials = false;
SmtpServer.Credentials = new System.Net.NetworkCredential("youremail@hotmail.com", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Send #Email #SMTP
ADD COMMENT
Topic
Name
5+4 =