<bdo id='mwa0b'></bdo><ul id='mwa0b'></ul>
        <i id='mwa0b'><tr id='mwa0b'><dt id='mwa0b'><q id='mwa0b'><span id='mwa0b'><b id='mwa0b'><form id='mwa0b'><ins id='mwa0b'></ins><ul id='mwa0b'></ul><sub id='mwa0b'></sub></form><legend id='mwa0b'></legend><bdo id='mwa0b'><pre id='mwa0b'><center id='mwa0b'></center></pre></bdo></b><th id='mwa0b'></th></span></q></dt></tr></i><div id='mwa0b'><tfoot id='mwa0b'></tfoot><dl id='mwa0b'><fieldset id='mwa0b'></fieldset></dl></div>
      1. <small id='mwa0b'></small><noframes id='mwa0b'>

        <tfoot id='mwa0b'></tfoot>

        <legend id='mwa0b'><style id='mwa0b'><dir id='mwa0b'><q id='mwa0b'></q></dir></style></legend>

        无法从 Azure 云服务使用 Gmail smtp

        Cannot use Gmail smtp from Azure Cloud Service(无法从 Azure 云服务使用 Gmail smtp)

          <tbody id='BlCU8'></tbody>

            <bdo id='BlCU8'></bdo><ul id='BlCU8'></ul>

            <small id='BlCU8'></small><noframes id='BlCU8'>

                  <tfoot id='BlCU8'></tfoot>
                  <i id='BlCU8'><tr id='BlCU8'><dt id='BlCU8'><q id='BlCU8'><span id='BlCU8'><b id='BlCU8'><form id='BlCU8'><ins id='BlCU8'></ins><ul id='BlCU8'></ul><sub id='BlCU8'></sub></form><legend id='BlCU8'></legend><bdo id='BlCU8'><pre id='BlCU8'><center id='BlCU8'></center></pre></bdo></b><th id='BlCU8'></th></span></q></dt></tr></i><div id='BlCU8'><tfoot id='BlCU8'></tfoot><dl id='BlCU8'><fieldset id='BlCU8'></fieldset></dl></div>
                • <legend id='BlCU8'><style id='BlCU8'><dir id='BlCU8'><q id='BlCU8'></q></dir></style></legend>
                  本文介绍了无法从 Azure 云服务使用 Gmail smtp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我通过 Gmail 的 smtp 发送电子邮件的代码:

                  My code for sending email through Gmail's 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);
                  

                  代码在我的本地机器上运行,当我在 Azure 作为网站"发布时.

                  The code works on my local machine and when I publish at Azure as "Web Site".

                  但是当我在 云服务" 中发布时,我得到了这个异常:

                  BUT when I publish in a "Cloud Service" I get this exception:

                   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
                  

                  Windows Azure网站"与云服务"有什么不同会产生这种影响吗?

                  Is there anything that differ a Windows Azure "Web site" from a "Cloud Service" that could have this effect?

                  谢谢!

                  推荐答案

                  在 Web.config 中使用以下 SMTP 设置:

                  Use following SMTP settings in Web.config:

                  <system.net>
                      <mailSettings>
                          <smtp deliveryMethod="Network">
                              <network defaultCredentials="false" enableSsl="true" host="smtp.gmail.com" port="587" userName="xxxxxxx@gmail.com" password="xxxxxxxxxxx"/>
                          </smtp>
                      </mailSettings>
                  </system.net>
                  

                  我认为您传递了错误的凭据.在您的用户名中使用 @gmail.com 后缀并尝试将 bodyhtml 属性也设置为 true...

                  I think you are passing wrong credentials. Use @gmail.com suffix in your user name and try to set bodyhtml property true also...

                  希望这对你有用..它总是对我正常工作..

                  Hope this will work for you.. It always work correctly to me..

                  在 这个 SO线程.

                  这篇关于无法从 Azure 云服务使用 Gmail smtp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  WPF ListBox not updating with the ItemsSource(WPF ListBox 未使用 ItemsSource 更新)
                  Problem getting list box items added through jquery in code behind(在后面的代码中通过 jquery 添加列表框项目时出现问题)
                  Selected item in list box is null(列表框中的选定项为空)
                  ASP.NET: Listbox datasource and databind(ASP.NET:列表框数据源和数据绑定)
                  .NET 3.5 Listbox Selected Values (Winforms)(.NET 3.5 列表框选定值(Winforms))
                  Why does the WPF listbox change selection on mouse button down rather than button up?(为什么 WPF 列表框在鼠标按下而不是按下按钮时更改选择?)
                • <tfoot id='UYr9R'></tfoot>

                      • <legend id='UYr9R'><style id='UYr9R'><dir id='UYr9R'><q id='UYr9R'></q></dir></style></legend>
                        <i id='UYr9R'><tr id='UYr9R'><dt id='UYr9R'><q id='UYr9R'><span id='UYr9R'><b id='UYr9R'><form id='UYr9R'><ins id='UYr9R'></ins><ul id='UYr9R'></ul><sub id='UYr9R'></sub></form><legend id='UYr9R'></legend><bdo id='UYr9R'><pre id='UYr9R'><center id='UYr9R'></center></pre></bdo></b><th id='UYr9R'></th></span></q></dt></tr></i><div id='UYr9R'><tfoot id='UYr9R'></tfoot><dl id='UYr9R'><fieldset id='UYr9R'></fieldset></dl></div>

                        <small id='UYr9R'></small><noframes id='UYr9R'>

                          <tbody id='UYr9R'></tbody>

                          <bdo id='UYr9R'></bdo><ul id='UYr9R'></ul>