Setup and Configure SMTP Server on Windows Server 2008 R2

There has been some confusion about how to setup and configure an SMTP Server or mail relay on Windows Server 2008 R2. The confusion has arisen due to the SMTP server component not being managed from with IIS 7.5 but is instead managed from the IIS 6 console.  In order to have SMTP working you must install IIS 6 as a feature. The following steps will explain how to setup and configure SMTP from start to finish.

Note: The steps for installing an SMTP Server or mail relay on Windows Server 2012 are very similar except for a few minor GUI changes. See this post for the exact steps.

I have noticed a few forum posts where people are wrongly following the steps in this article thinking that they are setting up a mail server to send and receive emails for their domain – this is incorrect. The steps outlined in this post are to create a virtual SMTP Server or mail relay, which sends messages only. This is typically used when web applications generate emails and use the mail relay to deliver them. That is very different from setting up a mail server. If the latter is your desired goal and it is for a commercial operation, then I suggest you search online for steps to install and configure Microsoft Exchange Server for that purpose. If you are looking a free mail server then I recommend hMailServer.

Installing the SMTP feature

1. Click Start > Run and then enter servermanager.msc in the Open dialogue box then click OK to load Server Manager:


2. Use the Add Features Wizard to select SMTP Server on the Select Features page. To initiate this, right-click on Features and click Add Feature:

3. In the Features section check SMTP Server and click Next:

4. You may see a dialogue box like the one below stating that certain role services and features are required for SMTP:

5. Click Add Required Role Services and then you will return to the previous Features section. Ensure SMTP Server is checked then click Next.

6. In the Web Server (IIS) section, click Next to proceed to the Role Services section:

7. The Role Services should be pre-populated – IIS 6 Management Compatibility should be selected, and below it, IIS 6 Metabase Compatibility and IIS 6 Management Console should also be checked. Click Next to continue:

8. In the Confirmation section click Install:

9. In the Results section click Close to complete the installation of the SMTP Server:

Configuring the SMTP Server

The next step is to configure SMTP. To do so we will need to open Internet Information Services (IIS) Manager 6.

10. Click Start > Run and then enter inetmgr6 in the dialogue box then click OK to load IIS Manager 6.

11. In IIS 6 Manager right-click on SMTP Server and select Properties:

12. In the General tab, unless you want the SMTP Server to use a specific IP address,  leave the settings as they are so that the IP address is set to (All Unassigned):

13. To proceed, click on the Access tab:

14. Click on the Authentication button and ensure Anonymous access is checked and then click OK:

15. Once back in the Access tab, click on the Connection button. Select Only the list below and then click Add. Enter as the IP addess and then click OK:

The Connection setting controls which computers can connect to the SMTP server and send mail. By granting only localhost ( access, limits only the server itself the ability to connect to the SMTP server. This is a requirement for security.

16. Click OK to return to the Access tab and then click on the Relay button. Enter as the IP addess and then click OK:

The Relay section determines which computers can relay mail through this SMTP server. By only allowing the localhost IP address ( relay permissions it means that only the server itself can relay mail. Conversely, it prevents the SMTP server from being an open relay and being used to send unsolicited spam email by other computers on the internet, which could lead to the SMTP server being blacklisted.

17. Next, go to the Messages tab. Here you can enter an email address where copies of non-delivery reports are sent to. You can also configure the location of the Badmail director, however, the default setting should suffice:


18. Next, go to the Delivery tab:

19. Click on the Outbound Security button and ensure Anonymous access is selected. As the only server that can connect and relay mail through the SMTP server is localhost this security settings is fine:

20. Click OK to return to the Delivery tab and then click on Outbound Connections. Leave the defaults as they are:

21. Click OK to return to the Delivery tab and then click on Outbound Connections, then click on the Advanced button:


Here you will need to enter the fully-qualified domain name of the SMTP server. This will be the host name or A record that has been created in your DNS zone file. This is straight-forward to do but you will have to confirm how you do this with the party that manages DNS for your domain. I have entered as this is fully-qualified. If you click on the Check DNS button you can confirm whether your chosen name resolves successfully. In my case it does as I see the following:

 22. Click OK and then OK again to exit the SMTP Virtual Server Properties.

You can also perform this test by running nslookup to confirm the existence of the host name as well as confirming the IP address it resolves to – which should be the IP address of your server:


Please note that DNS is crucial to successful email delivery. If your SMTP server cannot resolve the domains it is trying to send messages to then it will fail. Ensure that the DNS servers you have configured are able to resolve DNS queries successfully. From the above screenshot you can see that the DNS server I have configured,, was able to successfully resolve my SMTP server’s hostname, This is one of Rackspace’s many DNS servers and I am 100% confident it works fine.

The reason I am highlighting this is because if your SMTP Server sits within a corporate network it will most likely use an internal DNS server. Often these are only configured to resolve internal namespaces therefore resolving external hostnames may fail. Also, firewall rules may block your SMTP Server from querying any DNS servers so please check and ensure DNS queries are resolved successfully and if not make sure it get fixed before going onto the testing phase below.

Another very important point about DNS is that you must ensure that you have a PTR record for reverse DNS lookups configured. The PTR record allows your SMTP Server’s public IP address to be resolved back to your hostname. Some of the big email service providers perform reverse DNS lookups of  mail servers connecting to them as a security measure to check their credibility or reputation. Your web hosting company should have a control panel that allows you to configure reverse DNS if you have a dedicated public IP address. Not having a PTR record will not guarantee email delivery failure but it will very likely delay email delivery and at worst may result in your messages being blocked and your host being blacklisted. I highly recommend you you configure a PTR record for your server.

Follow the instructions in this post which shows you how to verify correct DNS configuration using the SMTPDIAG tool.

23. The last configuration step will be to set the SMTP Service to Automatic so that it automatically starts when the server boots up. Open up the command prompt and run the command below to enable this setting:

C:\Users\Admin>sc config "smtpsvc" start= auto
[SC] ChangeServiceConfig SUCCESS

Then run the command below to confirm that the service is actually running:

C:\Users\Admin>sc query "SMTPSVC" | find "RUNNING"
        STATE              : 4  RUNNING

If the SMTP Service is not running the command above will not return a state/result. If that is the case then run the command below to start it:

C:\Users\Admin>net start smtpsvc
The Simple Mail Transfer Protocol (SMTP) service is starting.
The Simple Mail Transfer Protocol (SMTP) service was started successfully.

We are now ready to test the configuration.

Testing the SMTP Server

The next step is to verify that the SMTP server is able to send email successfully. To do this follow the steps below:

24. Create a text file on your desktop called email.txt and paste the following into it, remembering to change the email address information to reflect your own details:

Subject: Email test

This is the test body of the email


25. Save the changes to email.txt and then copy the file to C:\inetpub\mailroot\Pickup. The SMTP server monitors this folder and when it detects the email.txt file, it will read the contents and send the email to the address in the To: section. This should happen almost immediately.

26. Check the email address the email was sent to and it should arrive shortly – the email was sent to my Gmail account:


An alternative way of doing this is to use a script to perform the same email test. Simply save the code below into a file called email.vbs, remembering to change the email address information to reflect your own details:

Dim sch, cdoConfig, cdoMessage
sch = ""
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 1 ' cdoSendUsingPort
.Item(sch & "smtpserver") = ""
'    .Item(sch & "smtpserverport") = 25
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = ""
.To = ""
.Subject = "Email test"
.TextBody = "This is the test body of the email"
'.AddAttachment "c:\images\myimage.jpg"
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
MsgBox "Email Sent"

Once the file has been saved to the desktop double-click on it and it should automatically send the the email. A message box pops up to confirm that the email was sent:

Apparently there’s more than one way to skin a cat, there’s also more ways to test your mail relay server:

You can also use telnet and PowerShell to test mail sending/routing via SMTP Server. Please refer to this post to see how to do this.

You can also use an email web form application which is similar to a contact us page on a website which allows you to post some feedback, which then uses an SMTP Server to deliver the messages to specific email contacts such as that monitor this information. See this post to learn how to do this using an ASP.NET 4.0 C# email web form application.

That’s all there is to it! Now you have a fully functioning STMP server that can successfully send emails. Many of the companies that I have worked with use this method to send emails generated by their web applications.

If emails are not being successfully delivered you may notice that messages are building up in specific SMTP folders. Visit this post to understand the purpose of each SMTP folder and how to approach issues when messages are queuing up in those folders.

How to test outbound mail flow with a file in the Pickup folder
IIS SMTP Folder Structure and how SMTP service works
Testing SMTP Server from the command line
Testing SMTP mail relay with ASP.NET 4.0 C# email web form

  • Juan

    all my emails are queued, not out? What more need?

    • japinator

      Hi Juan. Do all emails end up being queued? Do any emails send successfully at all? Can you test mail routing using STMPDIAG? Go to this post and run the test and let me know the results.

      • john

        please i apply this method of sending mail from window server but does not delivery email to all domain , like gmx ,rediffmail and it deliver to yahoo , please can you help me to slove this probelm

  • marketingismagic

    I’m getting a “The service could not bind instance 1.” in the event log viewer for SMTPSVC. Any clues? This system has been working for a couple of years and only recently failed.

    • japinator

      Hi, it sounds like a port binding issue. So another service or program has bound itself to port 25 which is preventing the smtp service from binding to it. Try running the following command netstat -ano | find “:25″ which will look for the string :25 (port 25) in the output. The result should tell you the IP that port 25 is bound to and also the PID (process ID) using it. You can can then go into task manager to identify the PID and subsequent process. Try that and let me know your findings.

  • Ismail

    my emails are moving into bad mail folder

    • japinator

      Hi Ismail. Typically mail is moved to the Badmail folder when it cannot be forwarded to the intended recipient. In the Badmail folder open up BAD file to see the error message. Check the Diagnostic-Code specifically. Can you confirm whether all emails go into the Badmail folder or whether it happens for a small number?

      • ismail

        all mails go to the bad mail folder immediately

        • japinator

          In the Badmail folder open up BAD file to see the error message. Check the Diagnostic-Code specifically and confirm what’s there. We cannot know the cause if we dont have info such as error messages. Can you confirm whether all emails go into the Badmail folder or whether it happens for a small number?

  • Pingback: Setup and Configure SMTP Server on Windows Server 2008 R2 | vSysad « nileshnaik()

  • Siraj

    My emails are in the queue folder.

    • japinator

      Hi Siraj. Emails sit in the Queue folder when they cannot be sent/delivered. If the delivery fails with an error then they go to the Badmail folder. It sounds like a DNS problem. The best way to find out more is to enable SMTP logging. See this link to find out how to enable logging. Once enabled, the logs will indicate what is happening when mail delivery is attempted.

  • Naeem Munawar

    i created SMTP Server on windows server 2008 Standard. i want to configure and use this smtp server on my client computers. please guide how can i do this.

    • japinator

      You must first configure the server to allow connections from your clients. Go to Access tab > click on Connection button and add IP subnet of the clients. Then go back into the Access tab > click on Relay button and add IP subnet of the clients. Decide your preferred authentication method from the Authentication button. Then configure your clients to connect to the SMTP Server by either its IP address or FQDN (step 21 in the post).

      • Naeem Munawar

        Thank you for your reply. i just do that before your reply. but it is helpful for me to understand. can you tell me is there any utility to see live logs of the SMTP server. i want to see how many emails are being send from each user.

        • japinator

          There are commercial products that monitor the SMTP service and provide log analysis reports. Personally I would use the Microsoft log parser tool to scan the logs for specific strings and output it to a file such as csv or html.

  • Aditya Gupta

    I haed run the command netstat – ano and found that 25 port wasn’t in the list
    also, few of the mails i have found are in bademail folder, and some in queued. Saw logs in system32->smtpsv1 folder,
    something like ——–” 0 0 99 0 609 SMTP – – – -” appeared

    • japinator

      First thing to check is whether the SMTP Virtual Server is listening on port 25. Go to the properties > General tab > click Advanced and ensure port 25 is set under 25. If not change it to port 25 as this is the standard smtp port. Then restart the smtp service. The intended recipient’s email server is ‘’ and they have blocked sending email to the recipient. This is because they will perform a reverse DNS lookup on your SMTP Server’s IP address and if it doesn’t resolve they will assume that you are a spammer and then block the mail delivery. This post covers a similar issue to yours.

  • aditya gupta

    now i am able to send mails easily with this server by running the script you specified.

    but now i want to use this server to send mails from another system, which i have authenticated in properties. I mean i have allowed all system to use my smtp server.. now please tell how may i send it from another system which says, ‘pickup directory path not specified “

    • japinator

      Try testing whether you can send mail from the other systems by running the same script. You will have to change the IP from localhost ( to the IP of the SMTP Server. That way the other systems know where to send the mail. You shouldn’t see that problem anymore. Hope that helps.

  • Resistance-k

    Hello everyone, I also had the problem of all my emails getting queued (staying in the Queue folder and not being sent) by the SMTP server on windows server 2008 R2 after following the steps outlined in this article.

    After hours of research and trials, it turned out that you have to add an empty line at the end of the email.txt file (step 23 above).

    The email.txt file should end by a CR LF character, otherwise it will not be picked up by the receiving email servers, thus all your emails will stay in the queue folder.

    If the author of this article can update his text (step number 23) this would save the hassle of a lot of other users. Thanks.

    Best regards.

    • japinator

      Sorry to hear that you experienced some issues sending mail. I performed some testing and did not experience any problems sending to multiple mail servers running both Windows & Linux mail servers. It seems that with or without the line in the body ending in ASCII CR LF characters the emails should send ok.

    • japinator

      Hi Resistance-k, I have amended the email.txt file in step 23 per your advice. I generally don’t use this method for testing but decided to look into it further. My research found that some mail servers required strict adherence to RFC 2822 whereas others didn’t, which in turn impacted the delivery of emails. Thanks for pointing this out, kudos to you.

  • AlwaysLearning

    Since there is no GUI to set the Badmail and Pickup directories you must resort to using the adsutil.vbs file (installed at C:\inetpub\AdminScripts\adsutil.vbs by default) to edit the IIS metabase.

    The Microsoft advice for changing the Badmail, Drop, Pickup and Queue folders at the following URL is mostly-wrong, at least for IIS6:
    XIMS: Relocating the Directories Used by SMTP Service

    The correct commands are:
    adsutil.vbs set smtpsvc/1/dropdirectory “DriveLetter:\inetpub\mailroot\Drop”
    adsutil.vbs set smtpsvc/1/badmaildirectory “DriveLetter:\inetpub\mailroot\Badmail”
    adsutil.vbs set smtpsvc/1/pickupdirectory “DriveLetter:\inetpub\mailroot\Pickup”
    adsutil.vbs set smtpsvc/1/queuedirectory “DriveLetter:\inetpub\mailroot\Queue”

    Hope this helps somebody.

    • japinator

      Thanks, that info is very useful. The only folder location you can configure from the GUI is the Badmail folder. Step 17 in the post shows the Messages tab where this can be configured.

      • Eddie

        Sorry. I do not know how to create SMTP email accounts in Windows Server 2008 R2. Can you help me out on this please?

        • japinator

          Hi Eddie. The SMTP Server sends email only. The SMTP Server within IIS is generally used to send email generated from Web applications. You cannot add email accounts within it to enable receiving mail as this is not the role of an SMTP Server. If you need to be able to receive email to your domain you will either have to setup a server to handle incoming email such as a POP3, IMAP or Exchange Server or you can use a hosting company to provide you with this service. If your goal is merely to test that the SMTP Server works simply use your personal email in the To: section.

  • Eddie

    Sorry. How do I create a To: and From: email accounts for testing?

    • japinator

      For testing use your personal email in the To: section and you should use an existing email address from your domain in the From: section.

      • Jeffrey Lua

        Can I send send an email where the from is not an existing email address from my domain. Say the following information To: from

        • japinator

          Yes, as long as you use an email address from your domain. So I could as an address when sending out mail through my SMTP Server.

  • Pingback: Anonymous()

  • badr

    i did all this but i can’t find any email on my email adress :( nothing at all no inbox no spam , just nothing :'(

    • japinator

      Would you care to elaborate on the problem? What tests have you run? What do you see in the logs?

  • Kieran Johnston


    I did this but it is not working. The email.text stays in my Pickup folder. I did the SmtpDiag test here is my results:

    If you know how to fix this or point me in the right direction please let me know ASAP.

    If you would like me to screen share or anything please add me on skype my username is kieran.johnston14

    -Best regards

    • japinator

      I emailed you offline about this.

  • Carry_Grant

    Thanks for the post.

    I am setting up an environment where an application needs SMTP. I don’t need to send eMails externally outside of my lab:

    Application Server = Server 2012, My App, SMTP
    Exchange Server = Server 2012, Exchange 2010

    I don’t understand how SMTP interfaces with Exchange. Can you explain?

    All of my eMails are stuck in the queue.


    • japinator

      Apologies for the late reply. Exchange 2010 has its own transport engine which uses the SMTP protocol and is separate from Windows SMTP Server, which is what I refer to in my post. Please confirm that the emails you refer to as being stuck are on the application server? I suspect DNS has not been configured properly so the SMTP Server running on the application server cannot resolve the intended recipients’ domains to the Exchange server.

      • Carry_Grant

        I had to setup the Exchange Send and Receive connectors and also create an “Accepted Domain” in Exchange. Then your instructions worked. Thanks

  • Andyman

    Outstanding. You made something that would seem overly complicated extremely simple. Followed your instructions and images word for word and got this working in 5 minutes. You’re a gentleman and a scholar and I appreciate your writing this up!

    • japinator

      Hi Andyman, thanks for your kind words. I am very happy to hear that you were up and running in 5 minutes!

      • Andyman

        Just an excellent job with the screenshots.. made it child’s play. Thanks again.

  • John Kenny

    Thanks for the post.
    I have succeeded in sending email from the vbs file but not using the email.txt file.
    Any Ideas?

    • japinator

      Hi there, if the vbs file works then SMTP is working. The issue may well be with the txt file. Resistance-k commented earlier about this and highlighted a possible cause – the txt file not ending with a ASCII CR LF character. If the vbs file works I wouldn’t be too concerned. Alternatively you can test using telnet, instructions are here:

      Hope that helps.

    • japinator

      I have updated section 23 slightly. You should have more success with the email.txt file now.

  • Galacticos

    Thanks for the Super Awesome Knowledge which you have shared here. I would like to know can we use command prompt to send email ? In linux, We are using sendmail function and we will pass the parameter like (To, subject, From Subject ). Please let me know. Thanks for the Help.

    • Guest

      From a PowerShell prompt:
      PS C:>Get-Help Send-MailMessage

      • Galacticos


        • japinator

          Hi Galacticos! As the guest poster alluded to above, you can use PowerShell’s Send-MailMessage cmdlet. So run the following from the PowerShell console on your SMTP Server to send an email:

          Send-MailMessage –SMTPServer localhost -To –From –Subject “This is a test email” –Body “Hi Galacticos, this is a test email sent via PowerShell ”

          The full command line reference for this cmdlet can be found here:

          • Galacticos

            Thanks Japinator…:)

  • McFruit

    Thanks for your tutorial!
    I’m using php to create *.txt-files inside the pickup directory. All works fine but unfortunately I’m not able
    to send html e-mails. What kind of header information are necessary to generate a valid html e-mail? Thanks for your support.

    • McFruit

      Problem solved. I guess messy whitespaces aren’t welcome.

      Subject: {SUBJECT}
      MIME-Version: 1.0
      Content-Type: multipart/alternative;

      Content-Type: text/plain;
      Content-Transfer-Encoding: 7bit

      Use an HTML compatible email viewer to view this message!

      Content-Type: text/html; charset=utf-8
      Content-transfer-encoding: 8BIT



      • japinator

        Nice! Never been asked that before as the txt file is used for testing mail delivery only but it is definitely with knowing. Thanks for the info.

  • Pingback: Setup and Configure SMTP Server on Windows Server 2008 R2 | ASP.NET and C# code snippets()

  • Mircea San

    Thank you for information, very useful. I followed the steps, but I am stuck at one point. What I am trying to do is to send email through a SMTP server to Exchange 2010. I created send and receive connectors, but it still doesn’t work. I don’t think it’s a firewall issue as firewall is disabled. Messages remain stuck in the Queue folder. Any ideas what could be the problem?

    Thank you in advance!

    • japinator

      Hi Mircea, my guide is for setting up SMTP Server and NOT configuring SMTP on Exchange whhich does require setting up send and receive connectors. Are you setting up an Exchange server and trying to get the send connector working?

      • Mircea San

        Hi, thank you for your reply.

        The idea was to send email
        from non-Exchange system to Exchange. I am testing SolarWinds Network
        Monitoring and I wanted to sent alerts to Exchange. With the SMTP server
        didn’t work, the messages were stuck in the queue folder. I ended up
        setting the FQDN of a Client Access Server as SMTP server for sending
        alerts from SolarWinds and it worked.It is interesting why the messages were stuck in the queue.

        • japinator

          I believe the problem was due to DNS. If the SMTP Server processes the message but cannot deliver it immediately it places the message in the Queue folder. In any case, I am glad you found a solution. :)

  • dan

    I don’t normally comment on posts like this, but this time I must say thanks. Complete, accurate and making a MS admin task look easy!
    That takes some doing. You should write the windows manual!

    • japinator

      Hi Dan, thanks for your kind comments. I am very glad to hear that the guide helped you achieve the desired result.

  • Jovan

    Hi , everything workd like it shold be , but how can i see when peopel send mail to my domain ?

    • japinator

      Hi, the SMTP Server sends/routes mail and is not designed to receive mail. If you want to receive mail to your domain you should setup a server capable of receiving mail such as a POP, IMAP or Exchange Server.

  • Mateen

    hello, i have followed each and every step as its shown. but the email.vbs
    file when opened gives me the error as below.
    The pickup directory path is
    required and was not specified,
    and if i copt the text file in the pickup
    folder, even then i dont get the email.
    kindly help me folks.

    • japinator

      Hi, open the command prompt and run the following command:

      C:inetpubAdminScriptsadsutil.vbs enum /Smtpsvc/1

      Does it return any results? If so then scroll down to the “PickupDirectory” property and state what appears to the right of it.

  • Chris

    This tutorial is EXTREMELY well done. I have never setup an SMTP server before and it worked the very first time. Great work.

    • japinator

      Hi Chris, glad to hear that the steps helped.

  • Bryan Palmer

    This is fantastic!!!

    Thank you so much, I have never set up an smtp server before and this was an immense help thank you

    • japinator

      No problem Sir. Happy that the guide helped you.

  • Dreux Doty

    This is simply fantastic! Easy, peasy, mac&cheesy…I concur with all other praises in the previous comments…The only addition I’d offer you make is to have a “contribution” link somewhere…:)

    • japinator

      Hi, thanks for the feedback, am glad it made the setup easy! Please could you elaborate on what you mean by a contribution link? Happy to do it if it benefits readers/visitors.

      • Dreux Doty

        My apologies for the confusion…I meant a “contribution link” to your paypal account (i.e. I’d be MORE than willing to contribute some funds to you for taking the time to publish this VERY helpful information!)

        • japinator

          Thanks for the suggestion, I may add that in the future. In the meantime, your gratitude and kind comments are sufficient payment :)

  • John Alexis Consorte

    your really great men. you made the windows smtp server deploying more convenient and easy to use. Thanks!

  • Tree Man

    Ok, it works great in test, but how can I allow my terminal server users to use this for outgoing mail only? I have the ability to make a “send to” link in IE and Office apps (actually, using PWB, an IE hack) but I don’t know what executable to point it to for sending via the SMTP server.

    • japinator

      Hi, you can’t point to the executable directly as stmpsvc.dll runs in-process within inetinfo.exe process. Simply point your code to the IP of the SMTP server using port 25. The SMTP server listens on its configured IP and port and will forward on mail that it receives subject to its configured settings.

      • Tree Man

        When you say “point your code at the IP and port” we’re talking about Office apps and anything that has a “send file as” on the File menu. How do I configure that?

        • japinator

          My reference to pointing code at an IP and port was based on my assumption that you were using ASP.NET to send messages. I don’t know what the “send to” link you referred to is using to send mail but I am assuming it uses a mail client of some sort. So if it is using Outlook then update the outlook settings to point to the SMTP Server’s IP address. If your users are already using Outlook for company mail then this won’t work. Alternatively use an executable that can send mail such as Blat.

  • honlue

    i setup every thhing well, i copied the txt file and changed the sending from email to and the to email to, note that the does not exit on my domain but the to email exist. the message is not delevered but they are enteries created in the qeue directory each time i try to send, another thing is that my is another smtp server that i purchassed from a vendor, i wanted to do one myself so in the FQDN, i entered localhost. Please urgently need assistance

    • japinator

      Hi Honlue, if messages are in the queue folder then they are still being processed. They will remain there until the number of retries has been exceed after which they will be moved ot the Badmail folder. By now, they will either have been delivered successfully or failed. If they failed, then the reason for the failure will appear in message in the Badmail folder. What errors do you see? I suspect the issue is DNS related because Gmail will perform a reverse DNS lookup of your SMTP server’s public IP and it will fail as you have set your FQDN as localhost.

  • Abdou Motrani

    thank you so much for that tuto
    but, can i use it to send over than 250.000 email (using “mass sender”) with inbox result ?? im wait for your reply :)

    • japinator

      Yes, it can handle that many messages. For high availability you can cluster the SMTP service – I have seen this setup used many times and it works. However, I would suggest an alternative – offloading those messages to a 3rd party mail host such as Mailgun, Sendgrid or Socketlabs. They can guarantee delivery and save you the hassle of administering your own SMTP server.

      • Abdou Motrani

        possible explanation well how to use these sites I’ve noticed that they are not free

        • japinator

          You use the smart host setting in the SMTP server properties to forward emails onto those providers or your application can also connect to them directly over HTTP. Those providers are not free but they ensure your email gets delivered. When you setup your own SMTP server some mail hosts may reject your connections due to security if they think you are a spammer or you don’t have rDNS setup or because you aren’t on a white list. There a whole host of problems you could encounter. If that bulk email you want to send is business critical your time and money might be better spent on one of those previously mentioned providers.

  • Pingback: SMTP Virtual Server relays router email | oneil's blog()

  • gourish

    I have configured as instructions are given. But I am not able to understand is which mail ID do i need to configure for this? bcz i have hosted mail service office 365 . do i need to give a office 365 mail ID or I can give any mail like new creation of mail ID? pls help me on this. I am not getting from which id i have to send mails and to which id i need to receive mails.

    Thanks in advance.

    • japinator

      The SMTP service should be used to deliver messages generated by your applications, The from address can be any address from your domain or your Office 365 address. Obviously it would be better if the address actually exists so that if anyone replies to the messages they can be received and read accordingly. The to address must be a valid address so that it is delivered successfully.

  • pratik

    thanks simple, short and accurate info.

    • japinator

      No problem :)

  • Pingback: Relay your home router’s email with a SMTP server | oneil's blog()

  • brendon

    I have followed these steps but the email gets sent to the badmail folder. What would likely be prevent the email from getting sent?

    • brendon

      The error report shows: Unable to deliver this message because the follow error was encountered: “Error is processing file in pickup directory.”.

      The specific error code was 0xC00402CE.

    • japinator

      Hi Brendon, hopefully you have resolved this issue by now. If not, then the first question I would ask is, do the emails eventually end up in the Badmail folder? If so, when you open those messages up what errors do you see? Also, have you setup the PTR record?

  • Pingback: Setup and Configure SMTP Server on Windows Server 2008 R2 | SharePoint interests()

  • Pingback: Setup and Configure SMTP Server on Windows Server 2008 R2 | RickPham's Stash()

  • merums merums

    Thanks for the great article. I did setup and able to send emails to others. Like you mentioned I used the text file and pasted in pickup folder. Lets say i want to receive emails. What should I do?. In my godaddy I added a “A” record as “mail” and points to “” my smtp server. Then in MX section for “@” i gave Now if I send some mails to Should I get that mail in drop folder or any other folder ?

    • japinator

      Hi, the first thing I will say is that IIS SMTP server is not designed to service end users with mail, it is for forwarding/delivering mail therefore this is not a configuration I recommend. However, technically speaking it can work. Your DNS settings are correct, if you want to be able to receive mail, make sure the MX record with a priority of 0 is and delete the other one with a priority of 10. Also, make sure that the Connection setting (see step 15 above) is configured to be “All except the below” and remove – this means anyone can connect to your server. This is necessary if you want to receive email from anyone on the internet. Then stop and restart the SMTP service. After this point any mail sent to should appear in the Drop folder.

      I will say that this is only a half solution, because mail will be delivered to your mail server but you will still need to install a POP3 service to enable mail pickup for your users. You can install Visendo SMTP extender to enable this.

      If you want to run a proper mail server for your domain I recommend using Hmailserver which is a free and fully featured POP3/IMAP server.

  • Al Rashid

    Saved my big time, thanks a lot.

    • japinator

      Happy to hear the positive outcome.

  • siva kumar

    i had problem with this..can you guys help me??

    • siva kumar

      Hi anyone can troubleshoot my prob?

      • japinator

        Hi, what is the problem you are experiencing? You have not provided any information so I can’t help unless you give me some clues.

        • ANonymous

          Hi, I wanted to sent an outgoing email through my web application. I had configure SMTP server accordingly using GMAIL and its works for a testing mail but my web application not able to send the email out. Is there any other SMTP setting I need to do in my Web application?

          • japinator

            The fact that testing works ok means that your SMTP Server config is fine. Your application must point to the SMTP Server. Within the application you configure the IP or host name and port of the SMTP Server and it will send messages to the SMTP server to route appropriately. A quick Google search on sending mail via or php will get you the results you need.

  • rohit

    Thanks a ton….its working

    • japinator

      Good news, glad it worked :)

  • Talangka

    Hi, Is this going to work along side with McAfee AV.
    Our MIS says it will not be possible to setup email because McAfee is using port 25.

    BTW, I have a web program using PHP and its mail function is not working coz I can’t set up my email in the server. Any Suggestions.

    • japinator

      Hi, if any service on the server is already listening on port 25 then there will be conflicts between them resulting in either one or the other not starting at all. If your AV infrastructure requires McAfee to use port 25 and this can’t be changed you have 2 choices:

      Option 1 – you can change the default port for the SMTP service. I wouldn’t recommend this as any programs or services that need to connect to the SMTP server will need to be configured to point to the SMTP server using the alternative port number you assign it. To do this perform the following:

      1. Open IIS Manager 6
      2. Locate and expand the Servername and right-click the Default SMTP Virtual Server object, and then click Properties.
      3. On the General tab, click the Advanced button, click the Edit button, and then set the TCP port to an alternative port that is not in use, for example 2525.

      4. Restart the SMTP service and it should start listening on the newly assigned port.

      Option 2 – simply setup and configure SMTP on another server where there are no conflicts on port 25 and point your PHP application to the IP of this server.

  • Katie DeVogelaere

    Finally something that works! Helpful tip for checking to make sure the SMTP Server shows ‘Started’ go to RUN > inetmgr6 > right-click SMTP Virtual Server > Start ours showed ‘Stopped’.

    • japinator

      Glad it worked! Thanks for your comment. :)

  • Sunil

    Hi Japinator, the document is very useful. I have some more details required, i have a network which in not having connection to our corporate network. The site having internet accesss and the email and all using is through Webmail and the exchange we have in our corporate office is of 2007 version.
    My scenario is, we have a Server on the mentioned office which one we are using for warehouse management system, from this Server we have to generate automated mail to our customers when the entries are updated on the server. The WMS having mail configuration features, but how we can relay the mail using SMTP, we dont have any public ip, only have internet ip which may change when the connection reestablishes.
    suggest me the best option and configuration i can do to carry out this scenario,

    • japinator

      Hi Sunil, you only have two viable option here. Due to the “branch” site that runs your line of business (LOB) application being on a network that does not have a static public IP you could configure it to send mail via the Exchange server in the “main” site. You can setup a connector in Exchange to handle all mail from the LOB application and it will handle the delivery. You will also have to ensure firewall rules are configured to allow the SMTP traffic from the branch to main site.

      Alternatively, you can setup a mail relay in your branch site per the instructions in my post but use a 3rd party to deliver the messages. You would configure a “smart host” within the SMTP Server properties which enables another host to deliver the messages for you. There are several excellent services that provide SMTP delivery services. My preferred provider is Mandrill, they don’t charge for the first 12,000 message sent through them. Please note I have no affiliation with Mandrill, there are many other excellent providers out there such as Sendgrid, Mailgun and smtp2to to name a few.

      See this post for instructions on how to configure a smart host:

      You simply replace Gmail’s connection info with those of your chosen provider.

      Hope that helps.

      • Sunil

        Dear Japinator,

        thanks for the support, i will check the things and revert back to you if need further helps,

        • japinator

          No problem Sunil, anytime :)

  • williams verde

    Thanks for the post it was really helpfully.
    My server works perfect sending emails to gmail, hotmail, yahoo but when it try to send email to a company domains ie it doesn’t work

    What do you think ?

    • japinator

      Hi Williams, so from what you have said we know your server and infrastructure are sound. So the issue will be due to restrictions at the other end. Sometimes there may be a lag if your IP is “unknown” to them, after which mail delivery is successful. Did you setup the reverse DNS record? The next thing to verify is whether those end points require some extra layer of security such as SPF, DKIM and/or DomainKeys. Have you had any emails bounce back to you? Any NDRs?

      • williams verde

        Thanks for your reply Japitor,

        I’m sorry if my questions are to dom but how I verify if those end pints require SPF, DKIM etc ?

        How I can get it set up in my server ?

  • VPM

    Very detailed. Well explained. Thank you so much!

    • japinator

      No problem friend! :)

  • jeffrygardner

    Fantastic. As others have said, you made a daunting task easy. Thanks so much.

    • japinator

      Thanks! Happy to hear this! :)

  • Johnny

    Hey, great article but I realised it’s not about my issue. I want to make smtp servers on 2 local pc’s with windows server 2008 to test SMTP and POP3 funcionality. Could you please tell me how to set smtp for each pc to send email thru smtp from one to another? For example if I connect 2 PC’s one with ip and second one How should I set smtp servers and DNS on each pc?

    • japinator

      Hi Johnny. What applications will you be using on PC1 & PC2 to send the messages? What are you trying to achieve? I suspect you are trying to setup a mail server to test sending and receiving email, if that is the case then the above is not applicable. If you give me further details I can advise on what you need to do.

      • Johnny

        Thanks for answering so fast. I want to make an example email system scheme for my school project. I was thinking about hMailServer to send messages. I want to make this in a local network because it’s only school project, I’ve got 2 Windows Server PC’s on Virtual Machine from Oracle and they are connected as I mentioned earlier ( and, I thought I could set SMTP servers on both PC’s and just send email from PC1 SMTP to another SMTP server on PC2 and then just download it with some POP3 client there. So you’re right, it’s supposed to be a test for emails sending and reveiving system. I’ll be glad to hear any ideas.

        • japinator

          No problem Johnny, happy to help. SMTP Server is not the right solution for you, it only sends emails, to send and receive email for your domain use hMailServer. To make this work, setup another VM (virtual machine) in Oracle (presuming it is VirtualBox) and give it the IP of Install hMailServer on it and follow the instructions on their website. Are you using a real domain name or just making one up for use just in the lab? The answer to that questions affect the next course of action, let me know.

          • Johnny

            I’m just making some domain up for the lab. If you can please write to me at it would be simplier if you could explain it to me thru email please.

          • japinator

            Sure, will drop you an email over the weekend.

          • Johnny

            Great. Please remember because I’m in a hurry :-)

  • kurt

    what are the needs for installing smtp server …

    • japinator

      Hi Kurt, can you elaborate on your question? If you give me some more context I can give you a better answer. Are you asking what are the requirements to install SMTP Server? Or are you asking what are the real world use cases?

      • kurt

        Yes .. i am new to windows server and i have following queries about smtp server..

        1 ) Suppose i have an exchange server in my company and all my company emails are handling that server , then do i need to configure smtp server seperately in my domain controller ..

        2 ) is smtp server acts a an email server just like exchange server .. ??

        3 ) what are the real world sceneraios or use cases for installing smtp server..

        • japinator

          Thanks for answering those questions Kurt.

          1) If you already have Exchange then I would use it as a mail relay instead of installing a separate standalone SMTP Server. So no need to do any further work in your DC.

          2) SMTP Server sends/relays messages from a client to its intended recipient, that’s all it does. It doesn’t receive email like a mail server such as hMailServer or Exchange. Exchange itself is a huge product and much more that just a mail server but at its core it is a mail server that sends and receives emails for any domains configured on it. Please read the red paragraph at the top of htis post for more info.

          3) From my experience in web hosting, they are mostly used to send transactional emails. For example, when you purchase a product on a website you will receive a confirmation email or when changing your password you will receive a a similar email confirming the action that has just taken place. These are transactional emails where the web application generates and sends messages via an SMTP Server to you. There are however, a multitude of use cases.

          I hope this makes things a little clearer.

          • kurt

            what a solid post this is … informative and really helpful …

          • japinator

            Thanks Kurt, appreciate it!

          • kurt

            ur welcome .. looking forward to your other post..

          • kurt

            so in nutshell

            1 ) SMTP server relays or points its incoming request to desired email server ..

            2 ) exchange server host emails..

          • japinator

            You are correct – you put it more succinctly than I could :)

          • kurt

            you made it simple

  • Craig Stump

    Just wanted to say thanks for writing this!

    • japinator

      No problem Craig, appreciate it.

  • Nick Clayden

    This is a great guide! But my emails wont send.
    Is this possible on an VM VirtualBox Installation running Windows 2008?

    • japinator

      Hi Nick, yes the installation will work no problem on that setup. Are you using a residential broadband service?The problem could be anywhere but the first thing to check is whether you can telnet from your server outbound to a public SMTP server, that way you can confirm that the networking is OK. Also verify that DNS is working successfully. Let me know the results of your tests.

      • Nick Clayden

        Many thanks for your response!
        It will probably be a business internet connection. I won’t be able to test that until next week, but I will carry out your steps when I am back on the PC with my VM Server and come back then!

      • Nick Clayden

        I have two network adapters enabled:Internal Network (to allow client PC’s to join the domain) and a Bridged Adapter to the Network Card on the Host PC (thus to allow internet access. I tried to telnet the gmail SMTP servers and that failed. Maybe it’s to do with the Ports on VM Servers

        • japinator

          Can you ping Google’s smtp server? From my lab at home I can ping and telnet to no problem. If you can ping ok but not telnet then something is blocking port 25.