For Drupal 8 Install PHPMailer and SMTP:
Go to the root of your Drupal 8 project and execute below to install and enable smtp module from Admin interface or via drush
composer require phpmailer/phpmailer
composer require drupal/smtp
Configure SMTP at: /admin/config/system/smtp
Set SMTP as the default mailsystem
When on, all mail is passed through the SMTP module.
SMTP SERVER SETTINGS
The address of your outgoing SMTP server.
SMTP backup server
The address of your outgoing SMTP backup server. If the primary server can't be found this one will be tried. This is optional.
The default SMTP port is 25, if that is being blocked try 80. Gmail uses 465. See
http://gmail.google.com/support/bin/answer.py?answer=13287 for more information on
configuring for use with Gmail.
Use encrypted protocol
This allows connection to an SMTP server that requires SSL encryption such as Gmail.
Enable TLS encryption automatically
Whether to enable TLS encryption automatically if a server supports it, even if the
protocol is not set to "tls".
Amount of seconds for the SMTP commands to timeout.
Turn on the SMTP keep alive feature
Enabling this option will keep the SMTP connection open instead of it being openned
and then closed for each mail
Leave blank if your SMTP server does not require authentication.
If you have already entered your password before, you should leave this field blank, unless you want to change the stored password. Please note that this password will be stored as plain-text inside Drupal's core configuration variables.
E-mail from address
The e-mail address that all e-mails will be from.
E-mail from name
The name that all e-mails will be from. If left blank will use a default of: Portal
Name . Some providers (such as Office365) may ignore this field. For more
information, please check SMTP module documentation and your email provider
Allow to send e-mails formatted as HTML
Checking this box will allow HTML formatted e-mails to be sent with the SMTP protocol.
SMTP CLIENT SETTINGS
The hostname to use in the Message-Id and Received headers, and as the default HELO
string. Leave blank for using _.
The SMTP HELO/EHLO of the message. Defaults to hostname (see above).
SEND TEST E-MAIL
E-mail address to send a test e-mail to
Type in an address to have a test e-mail sent there.
Checking this box will print SMTP message
Enabling Debugging will help know the SMTP isssues, check the project page for other error refrences: https://www.drupal.org/project/smtp