WordPress uses the PHP mail() function by default to send emails, including contact form submissions, password resets, WooCommerce order confirmations, and admin notifications. Unfortunately, emails sent via mail() frequently end up in spam folders or are rejected entirely by receiving mail servers. Configuring SMTP (Simple Mail Transfer Protocol) solves this by sending emails through an authenticated mail server, dramatically improving deliverability.
Why PHP mail() Fails
The PHP mail() function sends email directly from the web server without authentication. This causes problems because:
- Receiving servers cannot verify the sender's identity
- SPF, DKIM, and DMARC checks often fail
- Shared hosting IP addresses may be blocklisted due to other users' behavior
- Gmail, Outlook, and Yahoo increasingly reject unauthenticated email
Choosing an SMTP Solution
You have several options for SMTP on SakuraHost:
Option A: SakuraHost SMTP (Your Hosting Email)
Use the email accounts created in your cPanel. This is the simplest option and works well for low-volume sites.
Option B: Google Workspace / Gmail SMTP
If you use Google Workspace for your business email, you can route WordPress emails through Gmail's SMTP servers for excellent deliverability.
Option C: Dedicated Transactional Email Service
For high-volume or mission-critical email (WooCommerce stores, membership sites), use a transactional email provider like Brevo (formerly Sendinblue), Mailgun, or Postmark.
Setting Up SMTP with WP Mail SMTP
WP Mail SMTP is the most popular SMTP plugin with over 3 million active installations. It supports all major email providers.
Go to Plugins > Add New, search for "WP Mail SMTP by WPForms", install and activate it. Navigate to WP Mail SMTP > Settings.
- From Email: Enter the email address you want WordPress emails to come from (e.g.,
noreply@yourdomain.co.tzorinfo@yourdomain.co.tz). This must be a real email account. - Force From Email: Check this to override the From address set by other plugins.
- From Name: Enter your business name.
- Force From Name: Check this for consistency across all emails.
Configuring SakuraHost SMTP
Select Other SMTP as the mailer and enter these settings:
- SMTP Host:
mail.yourdomain.co.tz(or the server hostname shown in cPanel) - Encryption: SSL
- SMTP Port: 465
- Authentication: On
- SMTP Username: Your full email address (e.g.,
info@yourdomain.co.tz) - SMTP Password: The password for that email account
Create the email account first in cPanel > Email Accounts if it does not already exist.
Configuring Gmail / Google Workspace SMTP
Select Google / Gmail as the mailer. WP Mail SMTP provides a one-click setup using the Google API. You will need to:
- Create a project in the Google Cloud Console
- Enable the Gmail API
- Create OAuth 2.0 credentials (Client ID and Client Secret)
- Enter these credentials in WP Mail SMTP settings
- Authorize the connection
The WP Mail SMTP setup wizard walks you through each step with detailed instructions.
Configuring Brevo (Sendinblue) SMTP
Brevo offers 300 free emails per day, making it an excellent choice for small to medium businesses. Select Brevo as the mailer, enter your Brevo API key, and the plugin handles the rest. Sign up at brevo.com.
Step 4: Send a Test Email
Go to WP Mail SMTP > Tools > Email Test. Enter your personal email address and click Send Test. Check your inbox (and spam folder) for the test email. If it arrives successfully, your SMTP is configured correctly.
Configuring DNS Records for Deliverability
Regardless of which SMTP method you choose, proper DNS records are critical. Configure these in your domain's DNS zone via SakuraHost cPanel > Zone Editor:
- SPF Record: A TXT record that specifies which servers are authorized to send email for your domain. Example:
v=spf1 +a +mx +ip4:YOUR_SERVER_IP include:_spf.google.com ~all - DKIM Record: A cryptographic signature that proves the email was not tampered with in transit. Set up via cPanel > Email > Email Deliverability.
- DMARC Record: A TXT record at
_dmarc.yourdomain.co.tzthat tells receiving servers what to do with emails that fail SPF/DKIM. Start with:v=DMARC1; p=none; rua=mailto:admin@yourdomain.co.tz
Troubleshooting Common Issues
- Connection timed out: Your hosting firewall may block outgoing SMTP. Try port 587 with TLS instead of port 465 with SSL. SakuraHost does not block outgoing SMTP ports.
- Authentication failed: Double-check your username (must be the full email address) and password. Ensure the email account exists in cPanel.
- Emails still going to spam: Check your SPF, DKIM, and DMARC records using MXToolbox. Also verify your sending domain is not on any blocklists.
- WooCommerce emails not sending: WooCommerce uses WordPress's built-in mail function, so WP Mail SMTP will handle WooCommerce emails automatically once configured.
For further reading on WordPress email, see the WordPress Plugin Developer Handbook and the PHP mail() documentation.