通过Google Apps帐户发送电子邮件是在本地进行的,但不在我的Web服务器上 [英] Sending email through a Google Apps account is working locally, but not on my web server

查看:166
本文介绍了通过Google Apps帐户发送电子邮件是在本地进行的,但不在我的Web服务器上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


通过Google Apps帐户通过C#发送电子邮件

我的问题是相同,所以我执行了如下的 Koistya的解决方案 。心碎的是,它在我的笔记本电脑上精美地工作,但是当移植到网络服务器时,它无法解释。

My question is the same so I implemented Koistya's solution as follows. The heartbreak is that it works beautifully on my dev laptop but when ported to web server it times out with no explanation.

我的SMTP配置位于我的 web.config 文件。我根据Koistya的答案做了mod:

My SMTP config is in my web.config file. I made mods based on Koistya's answer:

<mailSettings>
    **Changed**
      <smtp from="my@email.com">
        <network host="smtp.gmail.com" password="[password]" port="587" 
          userName="my@email.com"/>
      </smtp>
    **Original**
      <!--<smtp from="my@email.com">
        <network host="mail.domain.com" password="[password]" port="25"
          userName="my@email.com"/>
      </smtp>-->
</mailSettings>

我的.Net C#代码(之前和之后删除):

My .Net C# code (before & after removed):

  SmtpClient mSmtpClient = new SmtpClient();
  mSmtpClient.EnableSsl = true;
  mSmtpClient.Send(message);

正如我所说,这对我的开发环境很好,但不是在网络上。谁能帮忙?谢谢。

As I said this works great on my dev environment but not on web. Can anyone help? Thanks.

推荐答案

您的设置是正确的。我们使用gmail在我们的网络应用程序中一直发送邮件。您的服务器可能会阻止端口587上的传出流量。我会联系您的主机,看看他们是否可以帮助,否则您将需要新邮件或新的主机。

Your settings are correct. We use gmail for sending mail all the time in our web apps. Your server is probably blocking outgoing traffic on port 587. I would contact your host and see if they can help otherwise you will need new mail or a new host.

这篇关于通过Google Apps帐户发送电子邮件是在本地进行的,但不在我的Web服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆