How to send email to office365 smtp

0

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 : outlook.office365.com

Explicit connection

port 587

username/passwprd

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

0

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

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

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)

https://support.office.com/en-us/article/Enable-sending-email-on-behalf-of-another-user-in-Office-365-c5e7749d-244e-477f-998e-55d3876c22ec?ui=en-US&rs=en-US&ad=US&s=4&auth=2&nf=1

 
answered 11/16/2017 12:41:37 AM
add a comment
0
Hello,
 
You used the wrong security mode as instructed in our error message. Please consider the following one:
 
SecurityMode securityMode = SecurityMode.Explicit; string Server = "outlook.office365.com"; string Username = "xxxx@xxxxxxx.onmicrosoft.com"; 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
0

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("smtp.mail.yahoo.com", 587);
// Login to the server.
client.Authenticate("mytest@yahoo.com", "password");
 
// Create a new mail message.
MailMessage msg = new MailMessage();
msg.Subject = "Test Subject";
msg.BodyText = "Content";
msg.From = "from@mydomain.com";
msg.To = "to@somedomain.com";
// And send it.
client.Send(msg);
}
 
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.