You are currently viewing How to set up SMTP email for my WordPress Website?

By default, the PHP mail() function is disabled on our shared hosting server for security reasons and to prevent spam. But don’t worry, you can set up an SMTP email on your website and achieve the same functionality and even reach your inbox more often!

In this guide, we will walk you through how you can use SMTP mail on your WordPress website. First, we will see how to add an email address created in the cPanel account, and then we will see how to add an email from SendGrid you can use any of the methods that you want. To set up SMTP mail, you must have that email created on your control panel first. Once your email is created, you can use any SMTP plugin available for WordPress to set up SMTP. Here, we are using the plugin called “WP Mail SMTP”.

Setting up SMTP Mail using email from cPanel

1. Log in to your WordPress admin panel. Go to the Plugins and then click on the “Add New” button.

2. Search for the plugin called “WP Mail SMTP” and then click on the “Install Now” button to install that plugin.

install wp mail smtp

3. After the plugin is installed, click on the “Activate” button to activate that plugin.

activate wp mail smtp

4. Go to “WP Mail SMTP” > “Settings” from the sidebar and you will see the options to configure the plugin.

5. Here, you will find the following fields:
From Email: The email address from which the emails will be sent.
From Name: Sender name that you want to have for the emails.
Return-Path: If you want to receive undelivered emails to the sender email, you can check this box. If you do not want to receive bounced emails, leave it unchecked.
Mailer: Select the option “Other SMTP”
SMTP Host: The hostname for the outgoing mail server which you can find from your control panel. For example mail.yourdomain.com
Encryption: We recommend using TLS for encryption.
SMTP Port: Set 465 for SSL or 587 for TLS.
Auto TLS: If your server supports TLS, you can enable this option. If you have selected TLS, you will not see this option.
Authentication: Set it to “On”
SMTP Username: Full email address that you have created by following this guide.
SMTP Password: Password of the above email address.

smtp setup

6. Click on the “Save Settings” button at the bottom to save the changes.

7. To verify your settings, go to the Email Test tab and then enter one of your email addresses for the test and then click on Send Mail. If your settings are correct, you should receive an email from that mail that you have just set up.

send test email 1

Setting up the plugin with SendGrid

This method is only applicable if you need to set up SendGrid email with your website. Either you need to use the above method or the method described here, you do not need to use both methods at once.
To set up WP Mail SMTP plugin with SendGrid, first, follow steps 1-4 from above.

5. Here, you will find the following fields:
From Email: The email address from which the emails will be sent.
From Name: Sender name that you want to have for the emails.
Return-Path: If you want to receive undelivered emails to the sender email, you can check this box. If you do not want to receive bounced emails, leave them unchecked.
Mailer: Select the option “SendGrid”
API Key: Enter the API Key from your SendGrid account.

sendgrid smtp

6. Click on the “Save Settings” button at the bottom to save the changes.
7. To verify your settings, go to the Email Test tab and then enter one of your email addresses for the test and then click on Send Mail. If your settings are correct, you should receive an email from that mail that you have just set up.

If you have any queries regarding SMTP mail,  feel free to let us know.

I still want to use the PHP mail function, what should I do?

If you still want to use PHP mail instead of the SMTP mail method, you can also do that. However, we have disabled PHP mail by default for a reason. Sometimes, the user’s website can be poorly coded and can be compromised easily, in that case, if hackers have access to your website (but not cPanel) then they can still send emails and spam from your domain name without your knowledge that can firstly damage the reputation of your domain name, and can also lead to account suspension or termination.

To enable the PHP mail function, just set the PHP version of your website using the PHP Selector.
Also, keep in mind that, PHP mail function does not verify the sender’s email address, which most of the time causes emails to end up in the spam folder. This can be easily mitigated by using the SMTP method described above.

এই কনটেন্ট বাংলায় পড়ুন: কিভাবে ওয়ার্ডপ্রেস ওয়েবসাইটে SMTP ইমেইল সেট আপ করবেন?