I am using below Code for SMTP Configuration.
SmtpClient smtp = new SmtpClient
{
Host = data.SMTPServer, // smtp server address here...
Port = data.PortNo,
EnableSsl = data.SSL,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new System.Net.NetworkCredential(senderID, senderPassword),
Timeout = 30000,
};
smtp.Send(message);
One client has configured SMTP Server - smtp.office365.com.
SMTP Server throws back below Error - Without SSL :-
Error in processing. The server response was: 5.7.3 STARTTLS is required to send mail [XXX.XXX.PROD.OUTLOOK.COM]
With SSL :-
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 Client not authenticated to send mail. [XXXX.XXXX.PROD.OUTLOOK.COM]
Above SMTP Code works perfectly for rest of Clients. Any inputs what needs to be done to fix this?