Reliably send mail from WordPress and WooCommerce via SMTP
WordPress sends mail for passwords and forms, and a webshop with WooCommerce for every order: a confirmation for the customer and a notification for you. Those emails need to arrive. The confirmation email is proof for the customer that their payment went through. Here you can read how to make WordPress send mail via SMTP using a mailbox on your own domain, and what to watch out for with a webshop.
Why SMTP?
Without extra settings, WordPress sends mail via the PHP function mail(). The sender then becomes an address with the account name of your package, and you can't change that. Such mail often ends up in spam. Via SMTP, WordPress logs in with a real mailbox and sends mail just like your mail program does. Then you decide the sender yourself and it matches your SPF and DKIM records.
Step 1: a mailbox on your own domain
Create a mailbox that belongs to your shop, for example orders@example.com. See Creating an email address. Don't use a noreply address: customers reply to their confirmation with questions, and you want to read those. Also never use an address from Gmail or Outlook.com as the sender.
Step 2: setting up an SMTP plugin
Install a well-known SMTP plugin that's still being updated, such as WP Mail SMTP. Fill in the following:
| Setting | Value for WebOké |
|---|---|
| SMTP server | The server name of your package, such as linux2023.webawere.nl. Where to find this is explained in Finding your server name and DA username. |
| Port and encryption | 587 with STARTTLS (TLS), or 465 with SSL/TLS |
| Authentication | On |
| Username | The full email address of the mailbox |
| Password | The password of that mailbox |
| Sender address | The same address as the mailbox. The server may reject a different sender address. |
All settings at a glance can be found in All settings at a glance: servers, ports, and security.
Step 3: the same sender in WooCommerce
Go to WooCommerce > Settings > Emails. At the bottom, fill in the sender name (for example, the name of your shop) and the sender address. Use the same address as in the SMTP plugin. If you want notifications about new orders to go to a shared mailbox, change the recipient for that email. Don't turn off emails just for peace of mind: the confirmation for the customer is essential.
Step 4: checking SPF and DKIM
With SPF and DKIM, you show that the mail really comes from your domain. If your domain and mail are with WebOké, check My WebOké on the product page of your package under the Set up email card. Or check your domain with the Email check. To make changes: see Setting up and completing SPF and Turning on and checking DKIM.
Is your mail with another provider, such as Microsoft 365 or Google Workspace? Then have the website send mail via SMTP using a mailbox from that provider, and uncheck a box in DirectAdmin. See Sending mail via PHP doesn't work, the MX records point elsewhere.
Step 5: a test email
- Use the test function of your SMTP plugin and send a test email to an address with another provider, for example Gmail.
- Then place a test order in your shop, using the test mode of your payment provider.
- Open the email and look at the header lines. Does it show
spf=pass,dkim=pass, anddmarc=passwith your domain? You can read how to check this in Viewing and reading the header lines (headers) of an email.
Sending limits during busy periods
Each package has a maximum number of emails per day, 300 by default. This applies to everything combined: your mailboxes, webmail, and your website, including order confirmations. An order quickly generates two emails (customer and administrator). During a promotion or a busy day, you can therefore hit the limit; after that, emails that day are rejected and not automatically resent. If you expect more, contact us beforehand. You can read how to see how many you've sent in Limit for sending mail and Sending limits and the 'message limit reached' notification.
Still not receiving mail? Follow the step-by-step plan in My email isn't arriving or ends up in spam: how to find out why.
Further reading
- Free WordPress course, lesson 9.1 Email from WordPress
- Free course Email in Order, lesson 7.3 Mail from your website and forms
