Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created January 3, 2017 18:34
Show Gist options
  • Save strangerstudios/abf5cd5fbc853fefcee8702c7d19e18c to your computer and use it in GitHub Desktop.
Save strangerstudios/abf5cd5fbc853fefcee8702c7d19e18c to your computer and use it in GitHub Desktop.
Set reply-to header in emails to get around SMTP issues.
/*
Set reply-to header in emails to get around SMTP issues.
I forget why I needed this, but I believe WP Manril or an SMTP app was using the incorrect reply to.
*/
function my_pmpro_wp_mail($args)
{
if(!empty($args['headers']))
{
foreach($args['headers'] as $header)
{
if(strpos($header, "From:") !== false)
{
$args['headers'][] = str_replace("From:", "Reply-To:", $header);
return $args;
}
}
}
return $args;
}
add_filter('wp_mail', 'my_pmpro_wp_mail');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment