/*
Plugin Name: SMTP Test Email
Description: A simple plugin to test sending emails with your current WordPress SMTP settings.
Version: 1.0
Author: Your Name
*/
if ( ! defined( 'ABSPATH' ) ) exit;
// Add admin menu
add_action('admin_menu', function() {
add_menu_page(
'SMTP Test Email',
'SMTP Test Email',
'manage_options',
'smtp-test-email',
'smtp_test_email_page',
'dashicons-email'
);
});
// Admin page
function smtp_test_email_page() {
if (isset($_POST['smtp_test_email_nonce']) && wp_verify_nonce($_POST['smtp_test_email_nonce'], 'smtp_test_email_action')) {
$to = sanitize_email($_POST['smtp_test_email_to']);
$subject = "SMTP Test Email from " . get_bloginfo('name');
$message = "This is a test email sent at " . date("Y-m-d H:i:s");
if (wp_mail($to, $subject, $message)) {
echo '<div class="notice notice-success"><p>Email successfully sent to '. esc_html($to) .'</p></div>';
} else {
echo '<div class="notice notice-error"><p>Failed to send email. Check your SMTP settings.</p></div>';
}
}
?>
<div class="wrap">
<h1>SMTP Test Email</h1>
<form method="post">
<?php wp_nonce_field('smtp_test_email_action', 'smtp_test_email_nonce'); ?>
<table class="form-table">
<tr>
<th><label for="smtp_test_email_to">Recipient Email</label></th>
<td><input type="email" name="smtp_test_email_to" id="smtp_test_email_to" class="regular-text" required></td>
</tr>
</table>
<?php submit_button('Send Test Email'); ?>
</form>
</div>
}
How to Use
-
Create a new folder in
wp-content/plugins/called smtp-test-email. -
Inside it, create a file named
smtp-test-email.php. -
Paste the code above into that file or download plugin HERE.
-
Go to WordPress Admin → Plugins → Activate “SMTP Test Email”.
-
A new menu SMTP Test Email will appear in your admin sidebar.
-
Enter a recipient email and click Send Test Email.
We can fix SMTP issues for a $30 USD service fee.