In The Mix

As a SharePoint architect I have the business behind me and the Developers and IT Pro on my shoulders.

How to Configure IIS SMTP Server to forward emails using a Gmail account October 26, 2008

Filed under: SharePoint — fmuntean @ 8:03 pm

This is very useful when you want to test your outgoing email for SharePoint but not have access to an SMTP server.

  1. Create and setup a Gmail account to use POP3.

    Enabling POP3 in Gmail:

  2. Install the mail server role (POP3 and SMTP) 
  3. Configure the IIS Server to forward messages using that account:
    1. IIS SMTP Virtual server -> Properties ->
      1. Access Tab


    1. Relay Button


    You can specify only the servers that you want to be able to send email here by selecting Only the list below and adding your servers IP addresses.

    1. Delivery Tab


    1. Outbound Security Button:

    Select Basic Authentication and specify your Gmail account  and password. Check the TLS encryption.

    1. Outbound connections button

    Set TCP port to 587.

    1. Advanced Button

    specify the smart host as

  4. Now configure the Outbound email in SharePoint to send email to the server where you have installed this SMTP server.

107 Responses to “How to Configure IIS SMTP Server to forward emails using a Gmail account”

  1. Seber Enimer Says:

    Thanks so much dude I’ve been trying to this for a while

  2. Amy Says:

    Sorry, but what do you mean in #2. by install the mail server roles?

  3. fmuntean Says:

    Hi Amy,

    To install the Mail Server Role under Windows 2003 use the “Configure Your Server Wizard” application.
    Please see the following link for more info:
    Let me know if you need more help,

  4. Dat Tran Says:

    Hi Florin Muntean
    Thank you for posting .

  5. Aalap Shah Says:

    Thanks man.
    Thank you very much.
    I have been finding it for a long time.
    you helped me a lot.
    thanks again.

    and i need one support also.
    can u tell me how to configure our server to receive gmail mails in our pop3 server.
    i need it for my sharepoint learning.

  6. fmuntean Says:

    This post is on how to configure IIS to send emails using Gmail.
    If you want to read gmail as POP3 you will need to configure your gmail account and enable POP3 and or forwarding under gmail settings: GmailSettings
    Tip: You can also forward only some of your mail by creating a filter!
    Another way to read gmails is to use the freepop:
    If you want that SharePoint lists to receive emails then you will need to setup incoming email in SharePoint and drop all the emails in the dropfolder on the Web Fron End.
    Let me know if you need more details.

  7. Rodolfo Says:

    Hi, i have a problem i explain my situation
    I have one server(Petronilas) with WSS 3.0 and i configured the outgoing email and well with this section i configired SMTP but the problem is when i want to send alerts stak in Intepub/mailroot/Queue can yopu help me please.

  8. fmuntean Says:

    Hi Rodolfo,

    The email messages get stuck into the queue when the SMTP server is not capable of forwarding the email.
    I would check if you can send emails from the server through the firewall.
    Gmail is using the following ports:TCP 465 or TCP 587
    There are few ways to test if you can send emails from the server. However I have build an SMTP Client that will help you debug the issue. The log tab will contain the detailed errors if the sending of email fails.
    The tool is available here.
    Let me know if you have any issues.

  9. Soheil Says:

    I was wondering, is it possible to receive emails as well with the IIS SMTP Server?

    I ned to receive emails and pipe them to a php script on a windows box.


  10. Aalap Shah Says:

    hi dear
    sorry for late reply.
    i was not well.
    by d way i need more information on receiving the gmail mails to my sharepoint lists.

  11. fmuntean Says:

    IIS SMTP server can receive emails however not gmail emails dirrectly.
    One approach to receive emails sent to a gmail account into SharePoint is:
    For sharepoint to receive emails you will need to configure SMTP to drop the received emails into a folder then configure SharePoint to process the emails from that folder.
    Your IIS SMTP server needs to be available from internet and your gmail account have to be configured to forward incoming emails to your SMTP server.

    Another approach to get emails to SharePoint would involve a litle bit of code as I don’t know of any software that does this:
    Create a windows service application that reads emails from any email server as a client and drops the messages into a folder based on your preferences. You will need to replace the “to” address on the messages as SharePoint will use that for routing to the correct document library. You starting point might be to look into the freePOPs project.
    Configure SharePoint to read emails from that folder.

    Let me know if you run in any issues,

  12. Aalap Shah Says:

    i have already configured my sharepoint to take emails from
    but how to configure smtp to receive gmail mails.
    i have installed one smtp server on my machine.
    i have configured my gmail account to send mail on that server.

  13. fmuntean Says:

    Hi Aalap,
    Now the next step is to open your SMTP server to receive emails from Internet.
    You will need to get a public DNS address and then open and forward the SMTP port (TCP 25) to your SMTP server. make sure that you create an alias on the IIS SMTP server to match the DNS address and drop the emails in the same folder that SharePoint is looking for.
    After that you will need to configure Gmail to forward the emails to a fictive account on that IIS SMTP server. You can use Gmail forwarding filters to specify multiple accounts.
    SharePoint libraries would need to be configured to receive emails from those fictive accounts.

    Hope this helps,

  14. Aalap Shah Says:

    sorry but let me tell u one thing i m new in sharepoint and also in server administration.
    please can u send me some links or details for :get a public DNS address and then open and forward the SMTP port (TCP 25) to your SMTP server. make sure that you create an alias on the IIS SMTP server to match the DNS address and drop the emails in the same folder that SharePoint is looking for.

    i can create alias only. but i dont know anything about public DNS address. and open and forward the port to smtp server.

  15. vivek Says:


    thanks fr showing the right path.
    the only thing i have doubt in, is the

    web.config file

    what setting should i mention there?
    could you please let me know.

    thanks n regards

  16. vivek Says:

    plzzzzzzzzzz. help me out with the web.config for this way of sending mails. i am in a real need…


  17. fmuntean Says:

    There is no need for editing the web.config
    If you get into any issue please describe it so I can try to help you.

  18. Manikandan S Says:

    I followed this and its working file with my GMAIL ID. But its doesn’t works with my corporate ID which was maintained by GOOGLE. We are using the same SMTP and POP port to access our mail using outlook. But, If i entered my corporate ID to authenticate with google, i didn’t get any mail. If i use my own gmail ID, i got mail. Where did i miss the setting. Please reply……..

  19. fmuntean Says:

    As you can see I am not working for Goole and the corporate version of google is a paid version so you should be able to get support.
    However if you still want me to help, please create an account for me as fmuntean@yourdomain and use the “contact me” to send me the information, as I don’t use Google Apps Email.

  20. Xabier Says:

    I need more data for completing step 2,i don´t know how to configure it.Wich authentification method???
    wich domain i have to write??please help me!!

  21. fmuntean Says:

    Hi Xabier,

    This is a feature of the Windows operating system and installation steps depends on your OS version:

    For Windows Server 2003:
    For Windows Server 2008:

  22. shUndOne Says:

    I just found this blog post and I must say that I found it very helpful. I was able to get my home SharePoint server to Relay outbound alerts to my teamsite members. Thank you!

  23. Ioana Says:

    Great article … Still got a question: how can i setup a virtual smtp server for windows xp, IIS 5.1? I followed steps 1 and 3 (you’ve lost me at 2), but still when i open a telnet connection on the newly created domain, it asks me for an user name and password (altough I’ve given those when I’ve configured outbound security). I give the user and password i use for my gmail account but i cannot login and continue with the telnet.
    Any advice on how can I manage to send (only to SEND) an email from my local PC would be highly appreciated.


  24. amit Says:

    I have followed you step but it not working for how to check in sharepoint whether my mail is getting fired or not.


  25. fmuntean Says:

    Hi Amit,
    Please provide more information.
    What I found is that from time to time I need to connect to gmail from the same computer using the web as they fail to authenticate me requiring a captcha text to login.
    I think that they are looking into blocking this type of setup. For now I can live with this issue.

  26. sunkanmi Says:

    i have ms server 2008 running and i want to configure it to serve as a mail server (just like in ms server 2003). the smtp server was configured correctly but i still find it difficult to use ms outlook to send email through the smtp server. Pls is there a way out. or cant server 2008 be use as a mail server only

  27. fmuntean Says:

    Windows 2008 can be use as a server for sure.
    Check TechNet site to see how can you set it up correctly

  28. фаберлик Says:

    It is remarkable, rather valuable idea

  29. derekpm Says:

    Rather interesting. Has few times re-read for this purpose to remember. Thanks for interesting article. Waiting for trackback

  30. Juan Mendes Says:

    Hello, thanks for the article. I was however looking to do something slightly different. I was looking for a way to be notified when an email arrives into my inbox. I found that with a unix/php/sendmail server, I can forward the email to a php script to be processed (

    Is there a way to do that with IIS?


  31. […] ir savs tad meili aizies ar nereālu ātrumu un tad nabaga IIS.SMTP šamos košļās. Apmēram tā. instrukcija, un ja […]

  32. […] and then deliver emails directly or relay those emails onto your main SMTP server. This guide shows how you would set IIS SMTP server to relay messages from SharePoint to as an […]

  33. Yashpal Says:

    Hello !

    there is a register form on my website, it has a function to send confirmation email to user. & i am using Google apps service, as, which port should i use for sending mail from my website ?

  34. Brian Ward Says:

    You rock!!! Nuff said.

  35. […] and then deliver emails directly or relay those emails onto your main SMTP server. This guide shows how you would set IIS SMTP server to relay messages from SharePoint to as an […]

  36. Pathy Says:

    Hi I am a beginner How I can set a windows server with multiples emails. I read something to get a public DNS, can I use att as it, please explain a little bit more.

  37. suprit Says:

    can it possible to redirect mail coming to my gmail account to another website which i m develoing now;means whether it possible to read my emails from my website without going through gmail account if possible please notify me but the condition is still i have not purchased domain name i want to make that as an desctop application….

  38. Matti Einars Says:


    First of all thanks for this post it helped me when I moved my mail from my own server to gmail.

    I know it’s an old post but I’m suddenly having problem with the on my IIS XP server after about 8 months of flawless operations using gmail as my smtp service.

    Yesterday at 16:36 all outgoing mail from my webpage stopped from the server until I changed the service from on port 587 to a local service. But now I’m not using smtp service at gmail anymore! Has anyone else had this problem? Could it be that gmail is blocking me because of spam suspicion?

    Regards, Matti….

  39. fmuntean Says:

    Hi Matti,

    Found myself that once in a while it stops working. However there is a quick fix for this by using the IE to connect to the email on that computer and Google will ask you for some kind of account validation during the login using captcha.

    Hope this helps,

  40. tdir Says:

    I’m having the same problems as Matti as of April 30. Running XP IIS and it has stopped relaying. Event viewer shows event ID 4001, and says “The remote SMTP service rejected AUTH negotiation.” It still works from a Windows 2003 Server though, so I wouldn’t think Google did this to combat spam. They must have made some internal change that inadvertently affected IIS 5.1.

  41. me Says:

    And why is it acceptable to expose the organization to a megalithic data-mining entity?

  42. emeroo Says:

    I have Windows server 2008 & WSS3 installed .. when I try to add user and send mail to him I got this error “The user or users have been added successfully, but there was an error in sending the e-mail message. The server may not be set up correctly to send e-mail.” … I have a problem in sending mails from sharepoint to different servers … I have made the following configuration

    1. Start IIS6 Manager (Start/Adminisdtrator Tools)
    2. Drill down to the SMTP Server and right-click for the Properties.
    3. On the Access tab – Authentication button, have ‘Anonymous’ as the only one selected
    4. On the Access tab – Connection button, select ‘All except the list below’ and leave the list blank.
    5. On the Access tab – Relay button, select ‘Only the list below’ and add two entries – the ip address of the current server and the loopback adapter (
    6. On the Delivery tab – Outbound Security button, select ‘Basic Authentication’ and include the username and password of company’s mail /or GMail account.
    7. On the Delivery tab – Outbound Security button, tick the TLS option.
    8. On the Delivery tab – Advanced button, set the ‘Smart host’ to “”/or “”.

    9. From IIS7, In SMTP Mail I entered the company’s email address.
    10. I configured the sharepoint Outgoing mail from central administration.
    11. Also, I tried both 25 and 587 as the port number.(“Delivery” tab–>”outbound connections” –> TCP Port)
    12.Restart IIS.. and then I tested again but no mails sent from sharepoint.

    I used the “SMTP Test Tool” and tested my company’s mail, it send mails successfully. but can’t send using Gmail’s account.

    Also I installed a sharepoint feature that send mails(using System.Net.Mail), it doesn’t throw exceptions but it also doesn’t send mails.

    Any help or advice would be highly appreciated!
    Thanks in advance,

  43. fmuntean Says:


    For SharePoint to be able to send emails out you will have to configure Outgoing email in Central Admin site.
    You can point to the local SMTP server then forward them to either your corporate SMTP/Exchange server or to GMAIL using the info in this post.
    The SMTP Test Tool will tell you if the SMTP server is configured correctly to forward the emails. For that in the tool you will have to select what SMTP server to connect to and specify the server that is configured to forward the emails.

    You can test the SharePoint configuration by pointing the Outgoing Email to an SMTP server that drops all the emails in a folder locally.

    If you get any error or need more info let me know,

  44. fmuntean Says:

    If you purchase a domain name then you can add an MX record wich will point to your public IP (of your firewall I hope) then you can forward port TCP 25 (SMTP protocol) to your internal STMP/POP3/Exchange server to handle the emails.

  45. Henrique Says:

    It’s Work… Thanks very much!!

  46. john Says:


    excelent info, keep it coming…

  47. Daniel Says:

    Thank you!!!!!!

  48. gary Says:


    excelent post, keep it coming…

  49. Francois Says:

    Hi fmuntean,
    I followed all these instructions (SP2010) and I can’t see anything wrong, but I get an error when smtp tries to connect to gmail :
    #160005: Bad response from SMTP host’’: 530 5.7.0 Must issue a STARTTLS command first. f14sm5472187wbe.8 .

    Googling this doesnt’ give me much excetp what it obviously says, but except the port and the TLS Encruption I don’t see where to place those settings in addition.

    any idea ?

    PS : well done for keeping this thread updated after almost 2 years!

  50. fmuntean Says:


    I have tested and it still works.
    Please check the “Outbound Security” and make sure you have “TLS encryption” checkbox checked and that you are using basic authentication.

    PS: You can contact me using “contact me” on my blog with screen shoots and detailed info on how you tried to configure it.

  51. Francois Says:

    Just notice that it may have been because the “require TLS encryption” box was greyed out as in –> so I created certif and now can tick the box but still not working.
    Once I made a change restarting SMTP and IIS is enough right ?

  52. mchostv Says:

    Hello. And Bye.

  53. nlvraghavendra Says:

    Brilliant post. Helped me to configure the outgoing settings correctly. Thank you.

  54. fmuntean Says:

    That checkbox is actually used for the connection to your local SMTP server.
    SharePoint requires that your local SMTP would accept anonymous connections so the only way to have some security on the incoming connection is to setup the allowed IP addreses that connects to your SMTP server.

  55. Vasu Says:

    Hi fmuntean,

    You helped me a lot. Thank you very much.

  56. […] What we have done so far: Setup IIS SMTP server to relay to, as per these excellent instructions:… […]

  57. doofmann Says:

    Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds

  58. Fredel Says:

    Please, are you able to Pm me and tell me couple of much more thinks about this, I’m definitely fan of one’s weblog… 34

  59. visible man Says:

    Naturally, what a terrific internet site and informative posts, I will add backlink – bookmark this internet site? Regards,

  60. Excellent read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: And the last i wanted to say you to have a Merry Christmas. Let all your wishes make come true for you and your family and lets hope the next year be prosperous for all us.

    Merry Christmas.

    Thanks for lunch!

  61. Hello!, Pretty interest angle, we had been talking in regards to the same issue at work and discovered your website incredibly stimulating. So felt compelled to com?ment just a little thank you for all of your energy. Please maintain up the excellent perform your performing!

  62. […] done so far: Setup IIS SMTP server to relay to, as per these excellent instructions:…The local SMTP relay allows anonymous access.Both the local IP and the loopback IP have been […]

  63. Ashok. M Says:


    I followed each and every step, but it wont work for me.
    Please help 😦

    Ashok. M

  64. […] then deliver emails directly or relay those emails onto your main SMTP server. This guide shows how you would set IIS SMTP server to relay messages from SharePoint to as an […]

  65. myname Says:

    great article.

    I have a query will be great if you can assist

    Well i am building a solution based on sharepoint foundation which will be hosted for various clients so lets i deploy the solution for client1 at and for client 2 at now uses some email service provider for email hosting and not microsoft exchange lets say godaddy email solution or something. now is it possible to configure the two boxes 1 for client 1 and second for client2 with outgoing and inbound email for lets say or something else ? if yes it will be great if you can explain a bit on how to achieve this

  66. Steve Fleurant Says:

    Hi, for me I have another issue. I want to send my emails to another server in my lan network. The other server is using lotus, I try to put configuration according to this but Whatever I try it’s not working. I’m using Windows server 2008 have you ever done that, is it possible to send email using a lotus account. Thank you.

  67. Uhgo Lesiuk Says:

    Man… thanks a lot… this pots was everything i need … I was lokking for this since a week at least… honesty this is everything i needed! THANKS THANKS THANKS THANKS ! I will reproduce it in spanish with your name of course. Uhgo.

  68. fmuntean Says:


    It should be possible to send emails to lotus notes accounts.
    You have to configure SMTP on Lotus Notes side to accept anonymous connections on the standard port or use an SMTP bridge in between.
    this url contains information about LotusNotes SMTP capabilities:

    Contact me if you want to proceed further.

  69. fmuntean Says:

    The email functionality in SharePoint is not based on Exchange specifics. It uses SMTP protocols.
    There are two things to take in considerations:
    1. For outgoing email the receiving SMTP server has to accept anonymous access and use the default port.
    2. For incomming email SharePoint expects to get the eml files (emails) into a local folder.

    For your approach as long you use a different web application for each client you should be able to achieve this.

    Sending emails is easier than receiving. You just connect out to SMTP server from your ISP like I described in this blog post replacing specifics from Google to your provider.

    if you still need help please contact me.

  70. […] organization you can use it as a relay. There is an excellent walkthrough on configuring it at…. All you need is Windows Server. You do not need Exchange to do […]

  71. karthik Says:


  72. karthik Says:

    Man… thanks a lot… this pots was everything i need … I was lokking for this since a week at least… honesty this is everything i needed! THANKS THANKS THANKS THANKS ! I will reproduce it in spanish with your name of course. Uhgo.

  73. karthik Says:


    I followed each and every step, but it wont work for me.
    Please help


  74. Hi,

    I very easy followed each and every step, but it wont work for me.
    Please help


  75. Tristan Sirko Says:

    Thats a great article!

  76. Kreatyna Says:

    Some really nice stuff on this website , I love it.

  77. speech recognition Says:

    Thanks for taking the time to share this, I feel strongly about it and love reading more on this topic. If possible, as you gain knowledge, would you mind updating your blog with more information? It is extremely helpful for me.

  78. fmuntean Says:

    Please use the contact me link and send me as much information as you can about your issue.
    Saying is not working is not enough info for me to help you.

  79. Chris Pollan Says:

    OK what I need to do is to be able to store multiple g-mail accounts on one server. we have 20+ employees I have 2 windows server 2003 running and would like all our company mail to be stored on our in house servers we use g-mail now so that we have access to their apps but would really like all our incoming email to be stored here so that we can filter them better and have a more stable back up of important emails. I also have an OS-x mac server installed but not setup in the domain if that would be easier I would be happy to set it up and use it. thank you in advance for your quick response on this issue.

  80. business directory Says:

    I just like the valuable information you supply on your articles. I’ll bookmark your blog and check once more right here regularly. I am relatively sure I’ll be informed lots of new stuff right here! Best of luck for the next!

  81. Ishan Says:

    Hey…. Really one stop quick help guide…. really helpful..
    But in my scenario I am doing for Google Apps Which requires TLS Certificate (In my case it is disabled…)any idea how to solve it ????

  82. THis doesnot works

  83. minhtutwin Says:

    Thanks fmuntean for this post. I really appreciate for your help. I have been searching this solution for a long time. Really Thanks

  84. amit Says:

    Great article, well explained.
    I followed these steps.
    I am trying to send email using dotnet, in which web.config file consists of username, password, port, etc.
    After following the above steps, i am still not able to send an email.
    any help??

  85. Samir Patel Says:

    Thanks. I was lifesaver 🙂

  86. Registrarse en Hotmail Says:

    I do agree with all the concepts you have introduced on your post.
    They’re very convincing and will certainly work. Still, the posts are too quick for beginners. May just you please lengthen them a bit from subsequent time? Thanks for the post.

  87. Jeff A Says:

    Firstly, this is first rate.
    I ran across this a couple of days ago and would like to see your SMTP diagnostic app mentioned in response 8. I know it was a long time ago and I couldn’t obtain the app from the link.
    I wrote a rather crude vb script to test this but yours appears to be much more comprehensive
    I will appreciate if you can provide it for me.


  88. bargeld Says:

    I read this piece of writing completely concerning the difference of most
    recent and earlier technologies, it’s remarkable article.

  89. leigh Says:

    Thanks. Used this to setup SMTP on server 2008 with Google Apps today.

  90. Sierra Vista foreclosure Says:

    Hi, i think that i saw you visited my site so i came to “return the favor”.
    I’m trying to find things to improve my site!I suppose its ok to use some of your ideas!! My name is CURTIS I reside in Boston

  91. Jeremy Says:

    Very helpful. Have been searching for this for 6 months.

    Finally have voicemail to email with Shoretel!


  92. Leanna Says:

    Thanks for one’s marvelous posting! I actually enjoyed reading it, you will be a great author. I will make certain to bookmark your blog and will eventually come back at some point. I want to encourage you to definitely continue your great writing, have a nice afternoon!

  93. […] IIS SMTP relay Google […]

  94. Alieu Jallow Says:

    Hello, Thanks for the post

  95. KANAI SAHA Says:

    Dear Expert,
    I m facing one issue, i’ve configured iis 6.0 smtp relay with gmail as u described and in the gmail account setting added another domain account and kept it as default sender with the smtp of that domain, now when i am sending mail through iis smtp it passes through gmail smtp and again for final destination it sends from different domain id of gmail, finally when it reaches to any outlook it shows on behalf of the mail id. I want to remove this on behalf of and should reflect only that other domain email id on final destination.

  96. […] Post Title : How to configure iis smtp server to forward emails using a Source : Read More : How to configure iis smtp server to forward emails using a […]

  97. […] Post Title : How to configure iis smtp server to forward emails using a Source : Read More : How to configure iis smtp server to forward emails using a […]

  98. […] How to Configure IIS SMTP Server to forward emails … – Oct 26, 2008  · January 24, 2009 at 8:38 am. IIS SMTP server can receive emails however not gmail emails dirrectly. One approach to receive emails sent to a gmail account … […]

  99. […] Sending Email (SMTP) using Commercial Service such as GMail – Sometimes an SMTP server is not available and the use of a public server is required. The problem with this is that public serves only operate with SMTP Authentication i.e a username and password whilst connecting to the smart host.  This article gives a nice explanation for setting this up on SharePoint (Thanks In The Mix). Take me there […]

  100. Great tutorial – I have used it a couple of times.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s