Newsletters: Sendgrid SMTP
1. What is SendGrid?
SendGrid is an SMTP relay service which allows you to reliably and efficiently send bulk emails through their servers.
They have several ways of sending emails but in this case, you’ll be using their SMTP API.
SendGrid gives you some free credits to use and you only need to pay if you want to use more than that.
2. Setup SendGrid with the Newsletter plugin
Follow these steps to setup SendGrid with your WordPress Newsletter plugin.
2.1. Get SendGrid SMTP Credentials
If you don’t have a SendGrid account, you can just register for one. If you already have a SendGrid account, go to their site and login.
You’ll use the following SMTP credentials:
- SMTP Host: smtp.sendgrid.com
- SMTP Port: 25 or 587 (TLS) or 465 (SSL)
- SMTP Protocol: TLS or SSL with the respective port above
- SMTP Username: Your SendGrid account username
- SMTP Password: Your SendGrid account password
2.2. Insert the Newsletter plugin’s Settings
In your WordPress dashboard, go to Newsletters > Configuration > General > General Mail Settings.
For the “Mail Type” setting, choose “SMTP Server” and fill in your SMTP credentials as explained in the previous step.
3. Troubleshooting SendGrid SMTP
Sometimes the settings may not work in the Newsletter plugin.
The main reason for this in most cases is restrictions on the hosting by the hosting provider. We have seen this day in and day out where a certain protocol like TLS/SSL are blocked or that specific ports eg. 587 is blocked for outgoing connections or in some cases PHP socket connections using fsockopen() is completely disabled or partially restricted. Most of these things are for security purposes.
If you are unable to send with SendGrid and you get a connection timeout error or maybe a “Called Mail() without being connected” error it most likely means that the outgoing PHP socket connection to SendGrid’s SMTP server is being blocked by the hosting.
Simply email/phone your hosting provider and tell them SendGrid’s host, port and protocol and tell them that you are trying to make an outgoing PHP socket connection to that and would they please tell you if it is restricted and if it is if they can either unblock it or give you an alternative port to connect on.