A simple solution to a common problem
When I started working with WordPress, I relied on PHP’s mail() function to send emails from my site. But I soon realized that many messages weren’t reaching their destination or, worse, were landing in spam folders. Frustrated, I tried several available SMTP plugins, but most were overly complicated, packed with tons of options I didn’t need. That’s when I decided to build my own plugin: Simple SMTP Mailer Plugin, a lightweight, easy-to-configure tool designed to reliably send emails from WordPress.
Over time, I discovered msmtp, an external tool that let me manage emails outside of WordPress efficiently. While I love using it, I know not everyone has the time, technical background, or hosting setup to configure it. That’s why I wrote this article: to share my experience and offer a practical, hassle-free solution that works right inside WordPress. If you’re looking for a straightforward way to send reliable emails from your site, this plugin is for you!
If you already read my previous article on how to configure msmtp with PHP for WordPress, this post serves as a perfect complement for those who prefer a more direct alternative without external dependencies.
What makes Simple SMTP Mailer Plugin special?
Simple SMTP Mailer Plugin is designed to be minimalist, practical, and easy to use. It doesn’t overwhelm you with unnecessary features, yet it includes everything you need to send emails effectively. Here are its core features:
- Quick and easy setup: Configure your SMTP server from the WordPress dashboard in just a few minutes.
- Integrated PHPMailer: Leverages one of the most reliable and robust email-sending libraries.
- Guaranteed security: Your SMTP server password is encrypted using OpenSSL and WordPress security salts.
- Practical debugging: Includes debug levels to quickly troubleshoot and resolve issues.
- Easy testing: Send test emails directly from the dashboard to verify everything works properly.
How to install and configure the plugin
Step-by-step installation
Installing Simple SMTP Mailer Plugin is straightforward. Follow these steps:
- Download the plugin: Get the ZIP file or clone the source code from my GitHub repository.
- Upload the plugin to WordPress:
- In your WordPress admin dashboard, navigate to Plugins > Add New > Upload Plugin.
- Select the ZIP file and click Install Now. Then, activate it.
- Manual option (if you prefer):
- Copy the plugin code into a PHP file (e.g.,
simple-smtp-mailer.php). - Upload it to the
wp-content/plugins/directory of your WordPress installation. - Activate the plugin from the Plugins screen.
- Copy the plugin code into a PHP file (e.g.,
Initial configuration
Once activated, the plugin adds a new section to the WordPress admin menu. To configure it:
- Go to SMTP Mailer > Settings in the admin panel.
- Fill in the following fields with your SMTP server details:
- SMTP Host: For example,
smtp.gmail.com(if using Gmail) or your provider’s mail server. - SMTP Port: Use
587for TLS or465for SSL, according to your provider’s guidelines. - Security: Choose between
None,SSL, orTLS. Most modern servers use TLS. - Authentication: Enable this if your server requires a username and password (almost always required).
- SMTP Username: Enter your email address or the username provided by your mail service.
- SMTP Password: Type it here; the plugin will automatically encrypt it upon saving.
- From Email: Specify the email address that will appear in the “From” field (optional; if left blank, it defaults to the admin email).
- From Name: The name displayed in the “From” field (optional; defaults to your site title).
- PHPMailer Debug: Choose a debug level (0 to 4) to diagnose issues. Use 0 for production and higher levels if troubleshooting errors.
- SMTP Host: For example,
- Click Save Changes.
Example for Gmail:
- SMTP Host:
smtp.gmail.com - SMTP Port:
587 - Security:
TLS - Authentication: Yes
- SMTP Username:
[email protected] - SMTP Password: Use an app password if you have two-factor authentication enabled.
Important note: The plugin uses OpenSSL to encrypt the SMTP password. Make sure the OpenSSL extension is enabled on your server. If unsure, check with your hosting provider. Without OpenSSL, the password won’t be encrypted, which could pose a security risk.
Using the plugin day-to-day
Once configured, Simple SMTP Mailer Plugin takes care of routing all outgoing WordPress emails (such as notifications, password resets, or contact form submissions) through your SMTP server using PHPMailer. This ensures your emails land in the inbox instead of spam.
Sending a test email
To verify that everything works properly:
- Go to SMTP Mailer > Send Email in the admin dashboard.
- Fill in the fields:
- Recipient: The email address you want to send the test to.
- Subject: A subject line for the email.
- Message: Enter the content (HTML is supported if you’d like custom formatting).
- Click Send Email.
- Check whether the email arrived. If not, see the troubleshooting section below.
Use cases
The plugin is ideal for any scenario where WordPress needs to send emails, including:
- Automated notifications (new user registrations, comments, core/plugin updates).
- Password reset emails.
- Contact form submissions (using plugins like Contact Form 7 or WPForms).
- Order notifications and receipts in WooCommerce stores.
Troubleshooting
If an email fails to send, turn on debug mode:
- In SMTP Mailer > Settings, set the PHPMailer Debug level to 2, 3, or 4.
- Try sending a test email again.
- Check your PHP error logs for details on the failure. To enable WordPress logging, add these lines to your
wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
- Common issues:
- Incorrect SMTP credentials.
- Wrong port or security settings.
- SMTP server blocks (for example, Gmail might require an “App Password” if two-factor authentication is enabled).
Technical details of the plugin
If you’re curious about how the plugin works under the hood, here are a few technical details. You don’t need to understand them to use it, but they might be helpful if you want to customize it or learn more.
Secure password encryption
To protect your SMTP password, the plugin does not store it in plain text. Instead, it encrypts it using OpenSSL and WordPress salts (AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY). This ensures only your WordPress installation can decrypt it. The simple_smtp_mailer_encrypt() and simple_smtp_mailer_decrypt() functions handle this transparently.
Here is a simplified example of how the password is encrypted:
function simple_smtp_mailer_encrypt($plaintext) {
$key = simple_smtp_mailer_get_encryption_key();
$iv = simple_smtp_mailer_get_encryption_iv($key);
$ciphertext = openssl_encrypt($plaintext, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
return base64_encode($ciphertext) . '::' . base64_encode($iv);
}
PHPMailer integration
The plugin hooks into WordPress’s phpmailer_init action to configure PHPMailer with your SMTP server parameters. If anything fails (for instance, if the password is missing), the plugin falls back to PHP’s mail() function. However, this is not ideal since mail() is less reliable and prone to deliverability issues. Therefore, I always recommend verifying that your SMTP settings are correct.
Simplify sending emails in WordPress
Simple SMTP Mailer Plugin is the solution I created for anyone who, like me, wants to send emails from WordPress without hassle. It’s lightweight, secure, and straightforward—perfect for small sites, blogs, or even online stores needing reliable SMTP delivery. If you give it a try, I’d love to hear how it works for you or if you have any ideas to improve it. I hope this plugin saves you as much time and headache as it has saved me!
Have questions or need help with setup? Leave a comment on the blog or contact me—I’d be happy to help!