Skip to content

Instantly share code, notes, and snippets.

@vaughanm
Created December 2, 2015 21:47
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 vaughanm/fcdc10800375c2e37eda to your computer and use it in GitHub Desktop.
Save vaughanm/fcdc10800375c2e37eda to your computer and use it in GitHub Desktop.
WPMUDEV Appointments+ Custom Reply-to & From address in outgoing emails
add_filter( 'app_message_headers', 'app_custom_header' );
function app_custom_header() {
$admin_email = 'your_email@email.com';
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$content_type = 'text/plain';
if (!(defined('APP_EMAIL_DROP_LEGACY_HEADERS') && APP_EMAIL_DROP_LEGACY_HEADERS)) {
$message_headers = "MIME-Version: 1.0\n" .
"From: {$blogname}" .
" <{$admin_email}>\n" .
"Reply-To: <" . $blogname . "> <" . $admin_email . ">\n" .
"Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\n";
} else {
$message_headers = "MIME-Version: 1.0\n" .
"Reply-To: <" . $blogname . "> <" . $admin_email . ">\n" .
"Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\n"
;
add_filter('wp_mail_from', create_function('', "return '{$admin_email}';"));
add_filter('wp_mail_from_name', create_function('', "return '{$blogname}';"));
}
return $message_headers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment