locked
How to setup Database Mail to relay through Windows Server 2012 SMTP relay server RRS feed

  • Question

  • Hello there,

    Because our production and test servers are disconnected from Internet, I cannot use Database Mail using email server addresses. Instead I have setup the SMTP relay server in Windows Server 2012 which uses Office365 account. This server sits on internal network common for production and test servers.

    Problem is I can't find the way to setup Database Mail to relay emails through that SMTP server.

    Have anyone had similar issue and found the solution? It would save me a time of creating custom system to do that.

    Monday, June 11, 2018 9:40 AM

Answers

All replies

  • We have setup database mail utilizing a relay server for the SMTP

    For us SMTP relay server uses google account

    What we have done is set up local SMTP server in IIS using the required email and port details

    The full steps are as outlined here

    http://www.vsysad.com/2014/09/setup-and-configure-smtp-server-on-windows-server-2012/

    Only difference we did was to set the email details and TLS encryption for the Outbound Security tab as below. Also you need to set Smart host as smtp.office365.com in your case in Advanced window of Delivery tab 

    Once this is set up, you can start configuring database email

    Set up a profile first and for the Email account, just give an email account you need to use for the database email

    Then for the servernname highlighted below  give your internal IP and set the port accordingly

    for example for use port is 587 as its gmail (for office365 also its the same) and account setup will look like below


    Hope this helps you out in setting the relay server correctly

    The details are also specified here

    https://support.office.com/en-us/article/how-to-configure-iis-for-relay-with-office-365-eb57abd2-3859-4e79-b721-2ed1f0f579c9


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page






    • Edited by Visakh16MVP Monday, June 11, 2018 11:01 AM
    • Proposed as answer by Pirlo Zhang Tuesday, June 12, 2018 7:58 AM
    • Marked as answer by Enmebaragezi Tuesday, June 12, 2018 9:33 AM
    Monday, June 11, 2018 10:06 AM
  • "relay" email is a function of SMTP, not DB Mail.  You setup dbmail to send to the SMTP server.  The SMTP server does the rest.  You need to setup your SMTP server to relay to the outside world.

    Are you getting an error message or something?

    Please see:

    https://community.spiceworks.com/how_to/78873-so-you-need-to-setup-a-smtp-relay-in-windows-2012-r2-iis-6

    Monday, June 11, 2018 10:56 AM
  • Thank you Visakh16, it worked just fine. Looks like I was ALMOST correct in setup, just messed up authentication :)
    Tuesday, June 12, 2018 9:34 AM
  • Tom, this is exactly what I have done. I have setup a SMTP server (I know, i called it a "relay" server, as this is what it does) and as such it works just wine. Problem I had, was connecting Database Mail to that SMTP server so it can relay database mail to the outside world. Turns out the only thing I messed up was an authentication, the rest was fine. Anyway, thank you for your reply :)
    Tuesday, June 12, 2018 9:38 AM