WordPress Custom SMTP

DSDalton SuttonMarch 19, 2024
View AllHide Notes

How To Install

  1. Open your WordPress theme's functions.php file or a plugin's PHP file.
  2. Copy and paste the provided PHP snippet into the PHP file.
  3. Save the file.
  4. Check your WordPress login page to see the applied CSS changes.
  5. Adjust as needed.
<?php 

function daltonsutton_smtp_settings( $phpmailer ) {
    $phpmailer->isSMTP();

    $phpmailer->Host       = 'smtp.mailgun.org';
    $phpmailer->Username   = '[email protected]';
    $phpmailer->Password   = 'password123';
    $phpmailer->SMTPSecure = 'ssl';
    $phpmailer->SMTPAuth   = true;
    $phpmailer->Port       = 465;
    $phpmailer->From       = '[email protected]';
    $phpmailer->FromName   = get_bloginfo('name');
}
add_action('phpmailer_init', 'daltonsutton_smtp_settings');