Quantcast
Channel: Azure Virtual Machines forum
Viewing all articles
Browse latest Browse all 12545

Azure - Cannot send Email through SMTP

$
0
0

Hi

I'm unable to send email through SMTP from an Azure server from our own application (written in C#).
Running it from another server (not Azure) works fine.
There seems to be something with the SMTP host (smtp-mail.outlook.com) as other hosts, like gmail, works fine from Azure.

The error I get is:

---
The SMTP server requires a secure connection or the client was not authenticated.
The server response was: 5.7.57 SMTP;
Client was not authenticated to send anonymous mail during MAIL FROM [VI1PR07CA0132.eurprd07.prod.outlook.com]
---

The C# code is fairly simple:

var Mail = new System.Net.Mail.MailMessage();
Mail.To.Add(new System.Net.Mail.MailAddress("xxx@yyy.zz"));
Mail.From = new System.Net.Mail.MailAddress("xxx@hotmail.com");
Mail.Subject = "xxx";
Mail.Body = "xxx";
Mail.IsBodyHtml = true;

var Client = new System.Net.Mail.SmtpClient("smtp-mail.outlook.com", 587);
Client.EnableSsl = true;
Client.Credentials = new System.Net.NetworkCredential("xxx@hotmail.com", "xxx");
Client.Send(Mail);
What could be wrong and how to fix it?


Viewing all articles
Browse latest Browse all 12545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>