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.