Setting up SMTP on windows 2008 server (windows 2003) To use Gmail as SMTP host

December 6, 2008 by
Filed under: Software Configuration 

This is a post about how to setup an SMTP relay on windows 2008 server(should work same on windows 2003 since Microsoft didn’t update the SMTP console) to use a different mail server like gmail, or yahoo, or any email provider which offers an SMTP feature (currently i don’t think hotmail allows this.)

Step 1: Install SMTP and the Admin UI (which is the IIS 6.0 MMC different from the new IIS 7.0 MMC)

Step 2: Run SMTP IIS 6.0 MMC as Admin (if using UAC), and configure the outbound rules

To use SMTP server as a relay to gmail you would simply set these outbound connection settings.  You need to right-click on the virtual server and select properties.

Step 3: Test it out

To test it out you can create a new text file call it “mail.txt” and put this inside “

From:<the email address your from>
To:<yourtestemailaccount>
Subject: testing 1 2 3
Mail content to send.”

copy this file into the mailrootpickup folder, which should automatically be sent to see if it does indeed relay directly.

So this relay will send all mail to the gmail server using your gmail account (it overwrites the from address to always be from the gmail account but it is a free smtp relay and pretty easy to accomplish. If there are any problems forwarding make sure to check the relay/authentication settings for the inbound connections and don’t leave your relay open to public it could cause spam problems and get your gmail account removed.

Warning: Service reliability and Auto restart

I have noticed that if you restart IIS the SMTP server doesn’t come back online all the time, you may need to manually open IIS 6  console and start SMTP virtual servers, I am investigating this but wanted to point out a word of warning.

Update:  Apparently when you install SMTP it doesn’t default to auto-start as a service in the services snap-in, just update this to auto-start it should then work as expected.

Happy Mailing!

 

Comments

21 Comments on Setting up SMTP on windows 2008 server (windows 2003) To use Gmail as SMTP host

    [...] on setting up W2K8 to act as a relay to gmail, etc.  Pretty interesting article.   http://www.codingbliss.com/cb/?p=38&#160; I know this has been a pain point for many people and there’s not alot of information out [...]

  1. questr on Thu, 18th Jun 2009 8:03 pm
  2. Thank you, thank you, thank you! I needed some help tonight to get this setup and your instructions solved my problem!

  3. Дегтярев on Tue, 27th Apr 2010 6:14 am
  4. Успокойтесь!

  5. yurikus on Wed, 28th Apr 2010 11:37 am
  6. For WS2003 you must put smtp.gmail.com in “smart host” edit box under advanced

  7. Danne Pedersen on Mon, 30th Aug 2010 1:47 pm
  8. Hi,
    Still not get it to work. its simply not send anything
    I have open te ports in my router and in Windpws firewall…. still not happens :-(

    Can you help me out….

    best regards
    Danne

  9. Danne Pedersen on Mon, 30th Aug 2010 1:49 pm
  10. using IIS 7,5 and for the SMTP virtual server 6.0..
    Best regards again
    Danne

  11. Mike on Tue, 19th Apr 2011 12:29 pm
  12. Gret instructions. For me the test emails get to the mailroot/Queue folder and just sit there. I double checked all my settings, and created an outbound firewall rule for TCP port 587. I granted Network Service access to the folder but the test messages from the command prompt sit in the mailroot/Queue folder.

    Any ideas what I’m missing would be appreciated.

  13. 2K8R2 - Relay smtp - MCSEboard.de MCSE Forum on Wed, 6th Jul 2011 3:06 am
  14. [...] Leute, ich habe da was gefunden :Setting up SMTP on windows 2008 server (windows 2003) To use Gmail as SMTP host : Coding Bliss NUr leider steht da nicht wie ich die mails auf dem SMTP empfangen kann? Kann mir da jemand [...]

  15. Jason on Mon, 8th Aug 2011 4:05 am
  16. I have tried all the above but the msg I sent out stored at C:\Inetpub\mailroot\Queue

    Can you tell me what is the problem?

  17. davidvagyok on Tue, 6th Sep 2011 5:46 am
  18. Hi there! I have the same problem, all the mail goes to the C:\inetpub\mailroot\Queue folder, but never send the mails. Any idea? thanks in advance.

  19. Fred Zarnowski on Mon, 12th Sep 2011 11:45 am
  20. Hi All, Same issue here. Mail sits in Queue. Has anyone come up with a resolution? Thanks.

  21. Lucas on Mon, 12th Sep 2011 11:56 am
  22. Hi,
    You might check a couple different things
    1) Ensure virtual SMTP is started (IIS 6 manager) , and ensure that the SMTP is running as well i had an issue where it wasn’t running after re-boot
    2)Check to see if your DNS is setup correctly (check that the DNS service is started and running)
    3) Check the email in the folder has a period on the last line of the email text. Sometimes it can cause routing issues.
    4) Check your error logs and see if any errors are reports (event viewer)
    5) you can enable SMTP logging on general tab, check enable logging, by default it logs to C:\Windows\System32\LogFiles retry and see logs files.

  23. Fred Zarnowski on Wed, 14th Sep 2011 3:11 pm
  24. Thanks Lucas. I tried your steps and everything looks good but it is still not sending mail. Every test I run tells me that SMTP is up and running just fine. I am looking at our SonicWall Firewall and set the server up in that but still nada. Very frustrating.

  25. SMTPProject on Wed, 14th Sep 2011 11:40 pm
  26. hey Lucas,
    To test it out you can create a new text file call it “mail.txt” and put this inside “

    From:
    To: � <— where do i get this email?and how to configure?
    Subject: testing 1 2 3
    Mail content to send.”

  27. beto on Wed, 21st Sep 2011 1:28 pm
  28. Hi, for those who can’t achieve sending mail through smtp relay using gmail, it’s very important you have imap and pop3 enabled in the configuration of your account, if imap is not available then gmail will not allow you to send any message.

  29. Olivier on Fri, 18th Nov 2011 4:05 am
  30. Since, I’ve had hard time on this, let me expand:
    “Update: Apparently when you install SMTP it doesn’t default to auto-start as a service in the services snap-in, just update this to auto-start it should then work as expected.”

    “Service snap-in” = Start->All Programs->Administrative Tools->Services

    “SMTP Service” appears whith:
    – Name =”Simple Mail Transfer Protocol (SMTP)”
    – Description=”Transports electronic mail across the network.”

  31. Jasbir on Thu, 2nd Feb 2012 6:28 pm
  32. The steps are much appreciated.
    It got our mail-handler working.

  33. Robin on Thu, 9th Aug 2012 4:04 am
  34. For those people having problems where their email just sits in the queue folder:

    Make sure that you set the Smart host setting to your gmail/hotmail server e.g. smtp.hotmail.com (you can find this setting on the Delivery->Advanced… screen)

  35. Leonardo Cabral de Aguiar on Wed, 14th Nov 2012 12:12 pm
  36. To auto start SMTP service use:

    sc config smtpsvc start= auto

  37. jersey on Wed, 3rd Apr 2013 11:29 pm
  38. how about Pop3?i don’t need install this roles?

  39. Lucas on Mon, 8th Apr 2013 2:37 pm
  40. You don’t need to install POP3, it is a different protocol then SMTP. POP is an email storage format protocol, POP3 was a transfer protocol but has been replaced with SMTP in popularity, SMTP is the sending/receiving of email. You might be able to setup a POP3 proxy but that isn’t the topic of this post.

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!





%d bloggers like this: