vaughanm
12/2/2015 - 9:47 PM

WPMUDEV Appointments+ Custom Reply-to & From address in outgoing emails

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;
}