Posts Send email using Office 365 account
Post
Cancel

Send email using Office 365 account

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//source http://weblogs.asp.net/sreejukg/send-email-using-office-365-account-and-c
String userName = "user@domain.com";
String password = "your password";
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("ToAddress"));
msg.From = new MailAddress(userName);
msg.Subject = "Test Office 365 Account";
msg.Body = "Testing email using Office 365 account.";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Host = "smtp.office365.com";
client.Credentials = new System.Net.NetworkCredential(userName, password);
client.Port = 587; 
client.EnableSsl = true;
client.Send(msg);

origin - http://www.pipiscrew.com/?p=5964 send-email-using-office-365-account

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags