If you’ve ever sent an email from your WordPress website and noticed the extra “via” information (for example, “sent via yourserver.com”) in the sender details, you’re not alone. This often happens when your website uses the default PHP mail function instead of a verified SMTP connection.
In this article, you’ll learn how to remove the “via” information from WordPress emails by setting up your own SMTP server.
Why Use Your Own SMTP Server?
By default, WordPress uses PHP mail to send emails, which may cause authentication issues or display “via” information. Using an SMTP server ensures:
- Better email deliverability
- Professional-looking “From” details
- Compatibility with your domain’s SPF and DKIM records
- Elimination of the “via” tag in outgoing emails
Before proceeding, make sure you know your SMTP server details. Most web hosting plans already include an SMTP server or PHPMailer setup. If you’re unsure, contact your web hosting provider (for example, Bluehost, SiteGround, or Hostinger) for the correct SMTP information.
Step 1: Add Your SMTP Credentials
Open your wp-config.php file (found in your website’s root directory) using a text editor, then paste the following code just below the database constants:
define('SMTP_USER', 'your email'); // Username for SMTP authentication
define('SMTP_PASS', 'your password'); // Password for SMTP authentication
define('SMTP_HOST', 'your host'); // Hostname of the mail server (usually your domain)
define('SMTP_FROM', 'from email address'); // SMTP From email address
define('SMTP_NAME', 'from name'); // SMTP From name
define('SMTP_PORT', '465'); // SMTP port (25, 465, or 587)
define('SMTP_SECURE', 'ssl'); // Encryption type: ssl or tls
define('SMTP_AUTH', true); // Enable SMTP authentication (true/false)
Tip: For better security, define your credentials in
wp-config.phprather thanfunctions.php.
Step 2: Configure WordPress to Use SMTP
Next, open your functions.php file (located in your active theme directory) and paste this code:
add_action('phpmailer_init', 'custom_send_smtp_email');
function custom_send_smtp_email($mailer) {
$mailer->isSMTP();
$mailer->Host = SMTP_HOST;
$mailer->SMTPAuth = SMTP_AUTH;
$mailer->Port = SMTP_PORT;
$mailer->Username = SMTP_USER;
$mailer->Password = SMTP_PASS;
$mailer->SMTPSecure = SMTP_SECURE;
$mailer->From = SMTP_FROM;
$mailer->FromName = SMTP_NAME;
}
This tells WordPress to use your SMTP configuration whenever the wp_mail() function is called.
Step 3: Test Your Email
Once everything is set up, send a test email from your website (for example, using a contact form). You should now see your email sent without the “via” information in the sender details.
If you still notice “via” appearing, double-check your SMTP settings or confirm that your domain’s SPF and DKIM records are properly configured.
Conclusion
That’s it! You’ve successfully removed the “via” information from your WordPress emails using your own SMTP setup.
This approach improves both email deliverability and brand professionalism — and it only takes a few minutes to configure.
If you found this article helpful, please share it or leave a comment below.
Happy coding!