This blog post is about configuring gmail as smtp for SharePoint 2013/2016/2019 to relay email messages on behalf of SharePoint.
First of all we need to configure SMTP server on Windows server (Currently I am using Windows Server 2016 Standard)
If IIS Manager 6 feature/role isn't setup first we need to set it up from Add server roles & features.
Once configured, open IIS 6 Manager and right click on SMTP Virtual server and click properties:
Until we want SMTP server to use specific IP address, leave the setting as it is in General tab
Then click Access tab
Make sure by clicking Authentication button that anonymous access is selected
On Access tab click on connection button and select second option or choose first option with your server IP address added, then click OK.
On Access tab click on Relay and choose All except list below option as shown below
Then click on delivery tab, and choose
Outbound security button and select
Basic authentication and enter
gmail credentials and check
TLS encryption and click OK.
In the Outbound connection, enter 587 as TCP Port and click OK.
In the delivery tab click
Advanced button and fully qualified domain name FQDN and
smart host as smtp.gmail.com
Then login to gmail account which we are using as SMTP relay, click on
My Account and then
Sign in security and select
Allow less secure apps to
ON position
Don't forget to update POP UP setting of gmail account
Although gmail SMTP as relay has been completed and can be verified by using a simple Powershell command/script as below:
Just to explain, here from address can be used as any address but email will always be come from your gmail smtp relay email address we used above.
In order to complete SharePoint outgoing email, in Centeral Admin of SharePoint, click System Settings and Outgoing email settings