RSS

Configure Outgoing E-Mail Settings for SharePoint 2010 / 2013 to using Office 365 or GMail Relay

25 Sep

Any SharePoint Client, User, or Developer need an SMTP server to send e-mails to Internal or External SharePoint site users from a Workflow, Alerts, Request Site Access, and/or Any custom Apps that use SharePoint Outgoing e-mail setting to send e-mails.

SharePoint cannot be configured to send e-mail over encrypted port to the e-mail service. And Office 365 and Gmail required an SMTP connection that supports TLS encryption Surprised smile.

Fortunately, Windows Server (2008-2012) supports an SMTP relay for Office 365 and Gmail by install a local SMTP Rely Server that supports an encrypted connection (over TCP Port 587) Disappointed smile.

The Steps are easy and forward:

  1. Install SMTP Role (Windows Server 2008 and 2012)
  2. Configuring SMTP Service to Relying to Office365/Gmail SMTP
  3. Testing the SMTP Service Connection
  4. Configuring Outgoing E-Mail settings in SharePoint Servers
  5. Test Sending an E-mail from SharePoint Site

The following is the detailed steps:

Install SMTP Role

Windows Server 2008

  1. Open Server Manager and select Add Roles and Features.

  2. On the Select Features screen, choose SMTP Server. You may be prompted to install additional components. If that’s the case, select Add Required Features and select Next.

  3. Select Install

image

Windows Server 2012

  1. Open Server Manager and select Add Roles and Features.

  2. Select Server Selection and make sure that the server that will be running the SMTP server is selected and then select Features.

  3. On the Select Features screen, choose SMTP Server. You may be prompted to install additional components. If that’s the case, select Add Required Features and select Next.

  4. Select Install.

image


Configuring SMTP Service to Relying to Office365/Gmail SMTP

  1. Open Administrative Tools > and Click on Internet Information Services (IIS) 6.0
  2. Start SMTP Service by Expand the current server, Right-Click the [SMTP Virtual Server #1], and then select Start

    image

  3. Right-Click the [SMTP Virtual Server #1], and then select Properties
    image

  4. In Properties window, Click on Access tab
  5. In Access tab, Do the Following
    • in Access Control, Click on Authentication button
      image
    • Make sure Anonymous Access is checked, and click OK button
      image
    • in Access tab again, Click on Connection button
      image
    • Select which servers can connect to this virtual SMTP server, by default it is set to accept all. But we need to granting only localhost (127.0.0.1) access and all SharePoint Servers that will send emails using local SMTP server, this will limits only the server itself the ability to connect to the SMTP server. This is a requirement for security.
      image

    • In Access tab again, Click on Relay button
      image

    • Select which computer can relay through this SMTP, only allowing the localhost IP address (127.0.0.1) and all SharePoint Servers that will send emails using local SMTP server a relay permissions and it means that only the SMTP server itself can relay mail. This will prevents other computers on the internet to use your SMTP server and send spam emails which will lead your SMTP server to be BLACKLISTED
      image

  6. Now go to next tab, Messages tab, and change the limit message size to 10 MB. Then enter the email address where copies of non-delivery reports are sent to.
    image

  7. Go to next tab, Delivery tab, and do the following:

    1. Click on Outbound Security and enter the mail account credentials that will be used to send messages.
      image

    2. Select Basic Authentication, and enter the Gmail/Office 365 account username and password, and make sure to select TLS Encryption checkbox. Click on OK.
      image

    3. In Delivery tab again, click on Outbound Connections. We need to tell the server to use TCP port 587 when attempting to connect to Office 365/Gmail
      image

    4. Enter the number 587 in TCP port textbox, then Click on OK
      image

    5. In Delivery tab again, Click on Advanced button
      image

    6. Here you will provide FQDN name of your domain and smart host, set the smart host to (smtp.office365.com) for using Office 365 SMTP, or (smtp.gmail.com) for using Gmail SMTP. Finally, clear the option to Attempt direct delivery before sending to smart host
      image

Click on OK, and Apply changes. This completes our SMTP level configuration
 


Testing the SMTP Service Connection 

  1. Create a Notepad file and enter the following
    To:username@outlook.com
    From:username@TempDomain.onmicrosoft.com
    Subject: Test E-Eail SMTP Rely




    This is a test email sent from my SMTP server (Office 365/Gmail)

  2. Save the Notepad file as email.txt
  3. Navigate to C:\inetpub\mailroot\Pickup
  4. Copy the email.txt from the desktop and paste it into the Pickup folder. It should disappear and send the email.
    image
  5. Confirm the the Queue folder is empty (no stuck emails) after sending the message, and you have received the test email.
    image
  6. Office 365 rely email message
    image
  7. Gmail rely email message
    image

Configuring Outgoing E-Mail settings in SharePoint Servers

  1. Go to Central Administration> System Settings –> Configure Outgoing Email Settings
  2. Enter the FQDN of the local SMTP server (Mail.Dev.local)
  3. Enter the From and Reply-to Address, and Select Character set, click OK to save settings.

    image

  4. Go to IIS manager on each SharePoint server, and select Server node from IIS, Right-Click on SMTP E-mail Icon, the Select Open Features
    image

  5. Make sure you enter and select the following:
    – Select Deliver e-mail to SMTP server
    – Enter FQDN of the mail server (Mail.Dev.Local)
    – Port number: 25
    Authentication Settings: Not Required
    image

  6. Click on Apply, and Reset the IIS (CMD –> IISRESET)

Test Sending an E-mail from SharePoint Site

In SharePoint Team site, I enable E-Mail Notification when a task assigned to user in a Task List
image

So, I create a new task and assigned it to me, and waiting to receive the task notification email

image

I receive the Task notification email successfully and it is works great Smile

image

I hope this is will be useful for you Smile

 

Tags: , , , , , , , , , , , , , ,

9 responses to “Configure Outgoing E-Mail Settings for SharePoint 2010 / 2013 to using Office 365 or GMail Relay

  1. jesusguz29

    April 18, 2016 at 7:57 pm

    Thanks for sharing!!

    I have configured the SMTP at the domain (mydomain.xxx.xxx), and all goes good. Because the email can be sent when I create a test TXT file and drop it into PICK UP folder of the MailRoot.

    In the “Outbound SMTP Server” of Central Administration, I enter (mydomain.xxx.xxx) There is no email sent after I set up the alert. I see the error “Cannot connect to SMTP host “mydomain.xxx.xxx” in the Windows Event log.

    I also tried to send and email from PowerShell cmdlet, but it fails.

    I really appreciate your help.

     
  2. Jason Bailey

    August 16, 2016 at 4:18 am

    your smtp host isn’t your domain, so would be something like smtp.mydomain.local depending on what you called when creating it.

     
    • Henricus

      August 18, 2016 at 7:52 pm

      Thanks Jason. I am a bit unclear where the mail.dev.local comes from. Is that the name of the server on which the new SMTP server is configured?

       
  3. Ammar Azeem

    October 17, 2016 at 11:05 am

    Thanks Alot. Your Step by Step elaboration help me alot in configuration of Local SMTP
    Cheers

     
  4. Rahul

    February 18, 2017 at 4:13 pm

    Hi Mr. Ali,

    Thanks for the sharing the content.
    I followed the above process and was able to send a mail at the very first instance when SMTP was configured.

    But, when I tried after 4 hours, no mail was triggered.
    I confirm that there were no changes made in the settings.
    Can you please tell me the possible reason because of which I might be facing the issue?

    Thanks.

    Best Regards,
    Tushar

     
  5. Ready2Learn For Pakistan (Learn from every thing.)

    March 2, 2017 at 9:19 am

    This is very awesome and well explained article showing clearly all steps. Thanks for your time Sir.
    Now i am going to try all steps.

     
  6. JoeMac

    July 19, 2017 at 10:48 pm

    Thank you for the time in establishing these steps –
    I do however have an open question – I have followed the steps outlined and can confirm that I have the SMTP process configured properly as I can send test messages from the SharePoint server to my corporate Outlook folder… However when I attempt to execute a list “E-mail a Link” or establish an email “Alert Me”, I receive a pop-up error message indicating “No apps are installed to open this type of link(mailto)”

    Any assistance that you may be able to provide is greatly appreciated in advance…

     
  7. gogi100

    January 10, 2018 at 9:01 pm

    hi, can I use some others smtp server instead gmail relay or office 365. I have my mail server but I cannot use your configuration. can I configure specially my smtp server

     
  8. oswaldjayatunge

    February 28, 2018 at 7:19 pm

    Thank you. Works like a charm. Great tutorial!

     

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

 
%d bloggers like this: