Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have gmail for our corporate email provider.

I want to be able to send mail through 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 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.

share|improve this question
Exactly same solution like @simon's link but with better explanation and guidance.… I had the need of local smtp server for configuring MS SSRS reports automatic email delivery – Vishwajit G Oct 14 '15 at 12:07

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: Port: 587

1) The port is very important. You may have to enter it like 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.

share|improve this answer
which SMTP gateway are you using? thats the main thing I don't understand how to configure – Simon Jan 3 '10 at 8:59
i already have these settings in my web.config. i need to know how to use an intermediary SMTP server to relay them – Simon Jan 3 '10 at 9:00
up vote 3 down vote accepted

Found this explanation here of exactly what I needed (when using IIS) :

I am sending mail using this C# code

var client  = new SmtpClient("", 587);
client.EnableSsl = false;

Note: the communication between my C# app and my local SMTP server is not encrypted (hence the EnableSsl=false) - but the communication between my SMTP server and GMAIL is encrypted (see the linked doc for more).

Important tip: If you are using the Microsoft SMTP client to relay mail make sure you don't have any domains in the 'Default SMTP Virtual Server > Domains' list. if so any email addressed to those domains will end up in C:\Inetpub\mailroot\Drop - which is probably not what you want in this instance. I just renamed to (literally) after having problems with outgoing mail not actually going out.

share|improve this answer
Ahh, ok. I see what you meant now. You wanted to use your own SMTP server as your local point, and Gmail's servers as the actual email sender. – Hector Sosa Jr Jan 5 '10 at 18:56
right - basically its about speed. it takes a few ms to send to my local server vs. up to 2-3 seconds to send to gmail - which may even fail – Simon Jan 6 '10 at 23:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.