Easiest way to configure local SMTP server to relay through gmail on Windows

gmailsmtp

We have gmail for our corporate email provider.

I want to be able to send mail through smtp.gmail.com from ASP.NET. I have managed to do this just fine – and it has the benefit of all sent items appearing in the correct sent items folder within gmail. However it can take up to 2-3 seconds to make a connection to smtp.gmail.com. Occasionally it will even fail completely. Since this is ASP.NET app I need to be able to reliably send email. I don't want to have to go and create some email daemon of my own – i just want to rely on SMTP.

I've tried with the Virtual SMTP Server on IIS6 but haven't been able to get it to work. An active current session is shown for up to a minute and then it disappears.

Do I need to use something like sendmail to do this – or some other free SMTP relay that gives me better control? I even found a sourceforge project called 'Gmail SMTP Relay' – and the hosted server we're using has installed – which has its own SMTP server.

I'd prefer something graphical – and most of all I'd prefer the Microsoft SMTP server becasue I already have it installed.

Best Answer

I fought with this for a few weeks. Here are the settings that I'm using on 3 ASP.NET websites that use SMTP gateway to send their emails:

Address: smtp.gmail.com Port: 587

1) The port is very important. You may have to enter it like smtp.gmail.com:587 in your SMTP server. I haven't touched Microsoft SMTP in years, so I can't remember what the setup screen looks like.

2) Make sure to enable SSL for SMTP, as gmail requires it.

3) SMTP Authentication should be set to Basic.

4) Make sure that you are using an actual email and not an email alias to authenticate. This one gave me lot of trouble.

This is how I got it working.

Related Topic