By default, WordPress uses PHP’s built-in mail() function to send transactional emails, including contact form submissions, password reset requests, new user account notifications, and WooCommerce order receipts. However, the default PHP mailer lacks cryptographic authentication (such as SMTP authentication, SPF, and DKIM signatures). As a result, major email providers like Google Gmail, Microsoft Outlook, and Yahoo often flag these unauthenticated emails as spam or reject them completely.

Configuring SMTP (Simple Mail Transfer Protocol) in WordPress ensures that every email generated by your website is routed through an authenticated mail server using secure SSL/TLS encryption. This guarantees reliable email delivery directly into your recipients’ inboxes.

In this comprehensive, step-by-step tutorial, you will learn how to configure SMTP in WordPress using the industry-standard WP Mail SMTP plugin (and alternative plugins like FluentSMTP), connect your custom domain hosting email, secure your credentials in wp-config.php, and send a live test email to verify deliverability.


Prerequisites


Step-by-Step Guide: How to Set Up SMTP in WordPress

Step 1: Install and Activate WP Mail SMTP

  1. Log in to your WordPress Admin Dashboard (e.g. https://domain.com/wp-admin).
  2. In the left sidebar, navigate to Plugins > Add New Plugin.
  3. In the search box in the top right corner, search for WP Mail SMTP (developed by WPForms).
  4. Click Install Now, and once the installation is complete, click Activate.

Step 2: Access WP Mail SMTP Settings

  1. In your WordPress dashboard menu, navigate to WP Mail SMTP > Settings (or click Settings under the General tab).

Step 3: Configure Primary Sender Information

In the General settings tab, fill in the primary sender information:

Setting Description Recommended Value
From Email The email address that will appear as the sender of all WordPress notifications. [email protected] or [email protected]
Force From Email Forces all plugins (WPForms, Contact Form 7, WooCommerce, Elementor) to use this verified From Email. Checked (Recommended)
From Name The human-readable sender name displayed in the recipient's inbox. Your Website Name (e.g. Aveshost Support)
Force From Name Ensures a uniform sender name across all site emails. Checked (Optional)

Step 4: Select Your Mailer (Other SMTP)

  1. Scroll down to the Mailer section.
  2. Select Other SMTP to use your custom domain email account provided by your web hosting server.
  3. (Note: You can also select dedicated API mailers like SendGrid, Brevo, or Mailgun if using external transactional mail services).

Step 5: Enter Your SMTP Server Credentials

Once you select Other SMTP, configure the connection parameters according to the following standard parameters:

Configuration Field Secure SSL / TLS (Recommended) TLS / STARTTLS
SMTP Host mail.domain.com mail.domain.com
Encryption SSL TLS
SMTP Port 465 587
Auto TLS ON ON
Authentication ON (Enabled) ON (Enabled)
SMTP Username Your full email address (e.g. [email protected]) Your full email address (e.g. [email protected])
SMTP Password The password for your email account The password for your email account
  1. Click the Save Settings button at the bottom of the page.

Step 6: Send a Test Email to Verify Delivery

  1. Navigate to WP Mail SMTP > Tools > Email Test.
  2. In the Send To field, enter your personal email address (e.g. your Gmail or Outlook address).
  3. Ensure HTML is toggled to ON.
  4. Click Send Email.
  5. You should see a green success message: “Success! An email was sent to your email address with test details.”
  6. Check your inbox to confirm delivery and verify that the sender displays as [email protected].

Alternative Option: Using FluentSMTP

If you prefer a 100% free, lightweight, and open-source SMTP solution with built-in unlimited email logging, you can also use FluentSMTP:

  1. In WP Admin, navigate to Plugins > Add New Plugin > search for FluentSMTP > install and activate.
  2. Navigate to Settings > FluentSMTP.
  3. Click Add Connection > select Other SMTP.
  4. Enter your From Email ([email protected]), From Name, SMTP Host (mail.domain.com), Port (465 with SSL or 587 with TLS), and your full username/password credentials.
  5. Click Save Connection and perform a test email from the Tools tab.

Advanced Security: Storing SMTP Credentials in wp-config.php

For enhanced security and to avoid storing your SMTP password in plain text inside the WordPress database, you can define your credentials directly in your wp-config.php file:

// Secure WP Mail SMTP Constants in wp-config.php
define( 'WPMS_ON', true );
define( 'WPMS_MAIL_FROM', '[email protected]' );
define( 'WPMS_MAIL_FROM_NAME', 'Aveshost Support' );
define( 'WPMS_MAILER', 'smtp' );
define( 'WPMS_SET_RETURN_PATH', 'true' );
define( 'WPMS_SMTP_HOST', 'mail.domain.com' );
define( 'WPMS_SMTP_PORT', 465 );
define( 'WPMS_SSL', 'ssl' );
define( 'WPMS_SMTP_AUTH', true );
define( 'WPMS_SMTP_USER', '[email protected]' );
define( 'WPMS_SMTP_PASS', 'YourSecurePasswordHere' );

Frequently Asked Questions & Troubleshooting

Q: Why does the test email return "SMTP Error: Could not authenticate"?
A: This error typically occurs when the SMTP Username does not match your full email address (e.g. entering just info instead of [email protected]), or if the password was entered incorrectly. Verify your email account credentials in DirectAdmin E-mail Accounts.

Q: Why does the connection time out on port 465 or 587?
A: Ensure that your SMTP Host is set to mail.domain.com (or your server’s hostname) and that your encryption type matches the port: use Port 465 with SSL or Port 587 with TLS.

Q: Why are contact form submissions still landing in the recipient's Spam folder?
A: Make sure your domain has active SPF, DKIM, and DMARC DNS records. In DirectAdmin, go to E-mail Accounts > click ENABLE DKIM to ensure all WordPress outgoing emails carry a verified cryptographic signature.

Q: Can I use Gmail SMTP (OAuth2) with WP Mail SMTP?
A: Yes. WP Mail SMTP supports Google/Gmail mailer using Google Cloud Console API credentials (OAuth 2.0). However, for professional business websites, using your domain's native hosting email ([email protected]) via Other SMTP provides higher sending limits and stronger brand authority.


Need Further Assistance?

If you encounter any issues configuring SMTP in WordPress, setting up contact form notifications, or verifying DNS authentication records, our technical support team is available 24/7. Feel free to submit a support ticket through your client area for expert assistance.

Was this answer helpful? 0 Users Found This Useful (0 Votes)