I Asp.net Kern Web-Anwendung haben und für das Senden von E-Mail-Mailkit mit:Asp.net Kern mailkit
emailMessage.From.Add(new MailboxAddress("John", "[email protected]"));
emailMessage.To.Add(new MailboxAddress("Doe", email));
emailMessage.Subject = subject;
emailMessage.Body = new TextPart("plain") { Text = message };
using (var client = new SmtpClient())
{
client.ServerCertificateValidationCallback = (s, c, h, e) => true;
client.Connect("smtp-mail.outlook.com", 587, false);
client.AuthenticationMechanisms.Remove("XOAUTH2");
client.Authenticate("[email protected]", "password");
client.Send(emailMessage);
client.Disconnect(true);
}
Während Anwendung läuft localy auf VS es sendet in Ordnung. Aber wenn ich laden Sie es auf Azure App-Service per E-Mail zu senden es andernfalls mit einer solchen Nachricht:
SmtpProtocolException: The SMTP server has unexpectedly disconnected.
MailKit.Net.Smtp.SmtpStream.ReadAhead(CancellationToken cancellationToken)
MailKit.Net.Smtp.SmtpStream.ReadResponse(CancellationToken cancellationToken)
MailKit.Net.Smtp.SmtpClient.SendCommand(string command, CancellationToken cancellationToken)
MailKit.Net.Smtp.SmtpClient.Authenticate(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken)
MailKit.MailService.Authenticate(string userName, string password, CancellationToken cancellationToken)
Jeder weiß, wie man es beheben?