我没有依赖我的主机发送电子邮件,而是考虑使用我的Gmail帐户发送电子邮件.这些电子邮件是我在节目中播放的乐队的个性化电子邮件.有可能吗?
我通过Gmail的smtp发送电子邮件的代码:
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential("my_user_name", "my_password");
MailMessage message =
new MailMessage(new MailAddress("from...@gmail.com"), new MailAddress("to...@gmail.com"));
message.Body = "body";
message.Subject = "subject";
client.Send(message);
Run Code Online (Sandbox Code Playgroud)
代码在我的本地计算机上运行,当我在Azure上发布为"Web站点"时.
但是当我在"Cloud Service"中发布时,我得到了这个例外:
System.Net.Mail.SmtpException: The SMTP server requires a secure connection
or the client was not authenticated. The server response was:
5.5.1 Authentication Required. Learn more at
Run Code Online (Sandbox Code Playgroud)
Windows Azure"网站"与"云服务"有什么不同可能产生这种影响吗?
谢谢!