Sending email through a Google Apps account is working locally, but not on my web server...

Posted by Janis Baldwin on Stack Overflow See other posts from Stack Overflow or by Janis Baldwin
Published on 2009-06-24T15:26:17Z Indexed on 2010/04/16 20:03 UTC
Read the original article Hit count: 343

Filed under:
|
|
|
|

Related:

Send Email via C# through Google Apps account

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.

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

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

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET