Skip to content

Instantly share code, notes, and snippets.

@sander1
Created February 17, 2017 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sander1/e38b7fa7686468646c8edc765232511f to your computer and use it in GitHub Desktop.
Save sander1/e38b7fa7686468646c8edc765232511f to your computer and use it in GitHub Desktop.
WordPress: Change Mail From and Return Path
add_filter('wp_mail_from', function($email) {
return 'you@your-domain.com';
});
add_filter('wp_mail_from_name', function($name) {
return get_option('blogname');
});
class email_return_path {
function __construct() {
add_action('phpmailer_init', array($this, 'fix'));
}
function fix($phpmailer) {
$phpmailer->Sender = $phpmailer->From;
}
}
new email_return_path();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment