Magento 2 Extensions:Custom SMTP
Take full control over email sending settings in Magento 2! Easily configure your SMTP settings in Magento 2, including ready-to-use settings for more than 27 providers, as well as the ability to debug email delivery issues and make sure emails are sent properly using the extensions built-in email log.
Interested in this Magento Extension?
Head over to our store to purchase this extension: Custom SMTP Settings (Magento 2)
Got questions? Feel free to contact us! Contact Form
Setting up the extension
- Please refer to our general Extension Installation and Setup Guide for installation instructions.
The extensions configuration section is located at System > XTENTO > Custom SMTP. Make sure to enable the module there.
Then, either use one of the ready-to-use settings templates, or simply enter the SMTP details of your provider including username/password there. Then, scroll to the bottom and use the "Test" section to send a test email to yourself, to verify the settings. Then, save the configuration.
E-Mails will now be sent using the Custom SMTP extension.
Using the extension
If logging has been enabled in the modules configuration, simply go to Reports > E-Mail Log to check/look up any sent email.
OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
This is a problem with your PHP configuration. See here for the solution: https://stackoverflow.com/questions/32019623/openssl-error-messages-error14090086ssl-routinesssl3-get-server-certificate
You will need to download the CA file and place it in the directory they state. Then add it to the php.ini file (you can find the "active" php.ini file using phpinfo()), then restart your webserver.
Make sure to properly set permissions as well, the /usr/ssl/certs/cacert.pem file should have chmod 755.
"Undefined / Timeout" while testing configuration
If you get a popup saying "Undefined / Timeout" when trying to test your SMTP configuration, there are two possible reasons:
1) Your server is behind a firewall. Your server cannot connect to the SMTP server and the connection times out. Contact your web hoster. Using SSH, you can verify/proof it like this:
cat < /dev/tcp/smtp.gmail.com/25
If the connection works, you should see some kind of response and no timeout. Otherwise, a timeout/error message, proofing it's a firewall issue. Try it with your SMTP server/port as well.
cat < /dev/tcp/smtp.gmail.com/587
cat < /dev/tcp/smtp.gmail.com/465
2) This is probably caused by you having installed two SMTP extensions in your store. Make sure to remove any other SMTP extensions from third party vendors from your Magento installation, it doesn't make sense to have more than one SMTP extension in a Magento installation. For example, make sure to remove the MagePal_GmailSmtpApp extension.
"Client was not authenticated to send anonymous mail during MAIL FROM"
1) Double check the username and password. For example, Office 365 sometimes require the User ID including the domain name to be used, and not the actual email ID.
2) Enable "Override From" and make sure to use the email address that is allowed to send emails (same as login usually)
If this doesn't help: This is not an issue in our extension but rather the settings / your email provider. Consult with your email provider.
"Error while sending E-Mail: Syntax error in parameters or arguments"
This usually means one of the email headers is missing. If the "From" header is missing, you can simply enable "Override From Header" in the extensions configuration and set the correct from email address.
Only test emails are sent, no other emails are sent/logged
This means you have another extension installed that tries to set up SMTP settings in Magento. For example, a SMTP extension of another extension vendor. Make sure to remove such extensions from Magento before installing our extension. Also, we're aware of the "Dotmailer" Magento 2 extension (Dotdigitalgroup_Email) to also cause this issue, as it also sets up their own SMTP settings in Magento.
Error: "Connection Refused"
Trying to send an email and getting "Connection Refused"? Either the hostname/port of the SMTP server you specified is wrong, or if you are 100% sure it's right, this means YOUR server is blocking the request. Please contact your hosting provider, they may need to whitelist outgoing connections on that port in their firewall.
Error: "Could not open socket"
Two possible reasons:
- There is a firewall on your server not allowing outgoing connections to the SMTP server on that port. Contact your hoster/server admin.
- OpenSSL not properly supported by the compiled PHP version. See here: https://stackoverflow.com/a/28436702/1320365
WHM / cPanel + Failed SMTP connection
Using WHM / cPanel and cannot get emails to send? Maybe SMTP Restrictions have been enabled in WHM. Go to "WHM > Security Center > SMTP Restrictions" and disable this. Also, check "WHM > Server Configuration > Tweak Settings > Mail > Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)" and make sure this is disabled.
Gmail: Please log in via 5.7.14 your web browser and then try again.
Uncaught Error: Call to undefined method Magento\Email\Model\Transport\Interceptor::testConfiguration()
Make sure "Module Enabled" is set to "Yes" and "Use Custom SMTP Settings" is set to "Yes" as well. Then click "Save Configuration". Then, try using the "Send Test E-Mail" button again.
One can use either their SendGrid.com website login credentials OR their API key:
Password: API Key starting with "SG."
Error: 1408F10B:SSL routines:ssl3_get_record:wrong version number
I'm getting an error similar to:
Could not open socket: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
This could be caused by wrong connection security setting. Try setting "Connection Security" to TLS or SSL or the other way round.
Zend\Mail\Transport\Smtp transport expects either a Sender or at least one From address in the Message; none provided
Error while sending E-Mail: Zend\Mail\Transport\Smtp transport expects either a Sender or at least one From address in the Message; none provided ...
That's a core issue in Magento actually. There are issues with the from email being empty: https://github.com/magento/magento2/issues/14952
Anyways, you can fix it by enabling "Override From" in our modules configuration and specifying a from email address. But then just one "From" email will be used. So, you will most likely need to apply the patches described in the link above, as it's a better solution.
Background information: Our extension cannot fix this core behavior of Magento - we are "just" the SMTP service, and the "email" that Magento gives us to send is already missing the "From" details.