How to send email to office365 smtp


Can you please provide some method in the documentaion to send emails from office365 smtp

I had tried it but i am getting the error

smtp :

Explicit connection

port 587


The error i am getting is SMTP; Client was not authenticated to send anonymous mail during MAIL

Can you please point me to the right direction

Sorry for the title it is (How to send email from office 365 smtp)

edited 11/28/2017 4:02:06 PM
asked 5/31/2016 9:44:02 AM
add a comment

4 Answers


I have email you the credentials on this ticket. Please check.

answered 11/16/2017 12:41:37 AM
add a comment

Glad i have found the problem, For those who are suffering with office 365 and componentpro like me, it was found that the issue was with from email in send method, and i was using the different email(not same as office 365 account) as i had given you the code. Another solution to this problem would be to set on behalf of in outlook 365(i haven't tested it with component pro)

answered 11/16/2017 12:41:37 AM
add a comment
You used the wrong security mode as instructed in our error message. Please consider the following one:
SecurityMode securityMode = SecurityMode.Explicit; string Server = ""; string Username = ""; string Password = "xxx@xxxx"; int InnerPort = 587; Smtp client = new Smtp(); if (client.IsConnected) client.Disconnect(); client.Connect(Server, InnerPort, securityMode); client.Authenticate(Username, Password); client.Send(Username, Username, "Test Email", ""); if (client.IsConnected) client.Disconnect();
answered 11/16/2017 12:41:37 AM
add a comment

Please send us the code segment that you used to connect to that server.

You can see the following code for connecting to Yahoo. The same code can be applied to your server.

// Create a new instance of the SmtpClient class and send an email.

using (SmtpClient client = new SmtpClient())
// Connect to the server.
client.Connect("", 587);
// Login to the server.
client.Authenticate("", "password");
// Create a new mail message.
MailMessage msg = new MailMessage();
msg.Subject = "Test Subject";
msg.BodyText = "Content";
msg.From = "";
msg.To = "";
// And send it.
answered 11/16/2017 12:41:37 AM
add a comment

Your Answer

Not the answer you're looking for? Browse other questions tagged mail smtp or ask your own question.