Created
January 3, 2017 18:34
-
-
Save strangerstudios/abf5cd5fbc853fefcee8702c7d19e18c to your computer and use it in GitHub Desktop.
Set reply-to header in emails to get around SMTP issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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