Visual studio 2017 邮件代码在localhost中工作,但之后不会在URL网站上工作
我在visual studio 2017上为ASP.NET core制作了一个web应用程序。它有一个联系人选项,用户可以向我发送电子邮件。当我收到反馈时,它在localhost中工作得非常好。当我使用Azure DevOps在门户中的Azure应用程序服务上构建/发布时,我的URL处的网站将失去电子邮件选项的功能。我使用MailKit编写了电子邮件代码,如果你们有更好的选择,请告诉我!多谢各位Visual studio 2017 邮件代码在localhost中工作,但之后不会在URL网站上工作,visual-studio-2017,azure-devops,smtp,azure-web-app-service,mailkit,Visual Studio 2017,Azure Devops,Smtp,Azure Web App Service,Mailkit,我在visual studio 2017上为ASP.NET core制作了一个web应用程序。它有一个联系人选项,用户可以向我发送电子邮件。当我收到反馈时,它在localhost中工作得非常好。当我使用Azure DevOps在门户中的Azure应用程序服务上构建/发布时,我的URL处的网站将失去电子邮件选项的功能。我使用MailKit编写了电子邮件代码,如果你们有更好的选择,请告诉我!多谢各位 var message = new MimeMessage(); m
var message = new MimeMessage();
message.From.Add(new MailboxAddress(inputEmail));
message.To.Add(new MailboxAddress("myemail"));
message.Subject = "Message from: " + inputName;
message.Body = new TextPart("plain")
{
Text = inputMessage
};
using (var client = new SmtpClient())
{
client.Connect("smtp.gmail.com", 587, false);
client.Authenticate("email", "password");
client.Send(message);
client.Disconnect(true);
};
return RedirectToAction("Index");
mywebsite.azurewebsites.net当前无法处理此请求。问题是您正在使用gmail。GMail只允许您在通过web从特定设备进行身份验证后,使用SMTP/IMAP/POP3进行身份验证。Oh!非常感谢。你建议我做什么?关于这个话题,我并没有那么了解