相关疑难解决方法(0)

通过Gmail在.NET中发送电子邮件

我没有依赖我的主机发送电子邮件,而是考虑使用我的Gmail帐户发送电子邮件.这些电子邮件是我在节目中播放的乐队的个性化电子邮件.有可能吗?

.net c# email gmail smtp

852
推荐指数
18
解决办法
53万
查看次数

无法使用Azure云服务中的Gmail smtp

我通过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"网站"与"云服务"有什么不同可能产生这种影响吗?

谢谢!

.net gmail smtp azure

12
推荐指数
3
解决办法
1万
查看次数

标签 统计

.net ×2

gmail ×2

smtp ×2

azure ×1

c# ×1

email ×1