HiBlog WordPress

How to Set Up WP Mail SMTP and Send WordPress Email over SMTP

  • Ali GhanimatiAuthor
  • Last updated
  • 5 minutesReading time
  • 755Views
  • Ali Ghanimati
  • Last updated:
  • 5 min read
  • 755 views
How to Set Up WP Mail SMTP and Send WordPress Email over SMTP

A customer fills in your site’s contact form and sees the green “sent successfully” message, but no email ever reaches your inbox. Or a user who forgot their password finds the reset email in the spam folder half an hour later. If these scenes sound familiar, the problem isn’t your site; it’s the way WordPress sends email.

In this tutorial we explain why WordPress emails get lost and how to set up WordPress SMTP with the WP Mail SMTP plugin and your own domain email, send a test email and fix common errors.

Short answer: by default, WordPress sends email with PHP’s own mail() function, without logging in to any mailbox, which is why email services trust it less. With the WP Mail SMTP plugin, WordPress connects to the mail server with the username and password of a real email account, such as info@yourdomain.com, and sends from there. Once it’s set up, send a test email from the plugin’s Tools section.

Why don’t WordPress emails arrive?

WordPress uses PHP’s mail() function to send email. Email sent this way goes out from the web server, not from a real mailbox; sometimes the sender address doesn’t even match the site’s domain, and there’s no login or authentication behind it. Gmail and other services are suspicious of such emails and send them to spam or reject them outright. Most WordPress email sending problems start right here.

SMTP is the standard protocol for sending email. When WordPress sends over SMTP with the username and password of a domain email account, the email leaves from your real mail server, backed by your domain’s SPF and DKIM records. We explain how SMTP differs from IMAP and POP3 in IMAP vs POP3 vs SMTP.

An SMTP server sends emails on to their destination

Before you install: create a domain email account

In cPanel, go to Email Accounts in the Email section and create an account such as info@yourdomain.com. Then click Connect Devices next to it; under Secure SSL/TLS Settings you’ll see the Outgoing Server and the SMTP port. These are the values you enter in the plugin. We cover creating the account step by step in How to Create a Domain Email in cPanel.

Installing the WP Mail SMTP plugin

  1. Log in to your WordPress dashboard and go to Plugins → Add Plugin.
  2. Type WP Mail SMTP in the search box and find WP Mail SMTP by WPForms.
  3. Click Install Now, then Activate.
WP Mail SMTP sends WordPress email through a mail server

After activation, the plugin’s Setup Wizard may open; you can follow it, or close it and go straight to the settings.

Setting the sender and the mailer

In the dashboard’s side menu, click WP Mail SMTP, then open Settings:

  • From Email: the email account you created in cPanel. Turn on Force From Email so other plugins can’t change the sender address.
  • From Name: the name recipients see, such as your shop or company name.
  • Mailer: choose Other SMTP.

When you choose Other SMTP, these fields open up:

  • SMTP Host: the outgoing server from the Connect Devices page, usually mail.yourdomain.com.
  • Encryption and SMTP Port: SSL encryption with port 465, or TLS with port 587. Leave Auto TLS on.
  • Authentication: on.
  • SMTP Username and SMTP Password: the full email address and that account’s password.

Finally, click Save Settings. If you don’t want the email password stored in your site’s database, the plugin lets you define it with the WPMS_ON and WPMS_SMTP_PASS constants in the wp-config.php file.

Sending a test email

From the WP Mail SMTP menu, open Tools and go to the Email Test tab. Enter an email address you can check and click Send Email.

If everything is right, you’ll see the Success message and the test email lands in your inbox. Check the spam folder too; if the email is there, check your domain’s SPF and DKIM records. We cover setting them up in How to Set Up SPF, DKIM and DMARC in cPanel.

WP Mail SMTP success message after sending a test email

If the test email doesn’t arrive

  • Authentication error (Could not authenticate): the username must be the full email address; re-enter the password or change it in cPanel.
  • Connection error (SMTP connect() failed): check the server name and the combination of port and encryption: port 465 with SSL, port 587 with TLS.
  • Certificate error: if no SSL certificate has been issued for mail.yourdomain.com, use the server name shown on the Connect Devices page.
  • Lots of emails: on HiData’s hosting, each hosting account can send up to 100 emails an hour and 1,000 a day. For newsletters with thousands of recipients, use a dedicated bulk email service.

FAQ

Can I send email through Gmail?

Yes; the Google / Gmail option is in the Mailer list, but you need to create an app in Google Cloud and get a Client ID and Client Secret. For a business site, an email on your own domain looks more professional and is simpler to set up.

Is the free version of WP Mail SMTP enough?

For sending through your hosting’s SMTP and sending test emails, yes. Features like keeping a record of every email sent (Email Log) are in the paid version.

Does my contact form use these settings too?

Yes; form plugins such as Contact Form 7 and WPForms, as well as WooCommerce, send email with WordPress’s wp_mail() function, and WP Mail SMTP routes all of it through SMTP.

Domain email on HiData hosting

On HiData’s cPanel hosting you create a domain email account in cPanel in seconds and give it to WP Mail SMTP, so your site’s emails arrive from your own address. Wherever you get stuck setting up SMTP, our 24/7 ticket support has your back! See the plans on our hosting page.

Share Post

hidata.org/en/blog/how-to-set-up-smtp-using-the-wp-mail-smtp-plugin/
In Social Media

Add Comment

Related Articles