Last active
December 18, 2018 14:55
-
-
Save joshfeck/7532398 to your computer and use it in GitHub Desktop.
use wp_mail_content_type filter instead of hard coding the content type in the email function. Event Espresso 3.1.35
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
| <?php | |
| function event_espresso_send_email($params) { | |
| global $org_options; | |
| do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); | |
| extract($params); | |
| //Define email headers | |
| $headers = ""; | |
| if ($org_options['email_fancy_headers']=='Y') { | |
| $headers .= "From: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n"; | |
| $headers .= "Reply-To: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n"; | |
| } else { | |
| $headers .= "From: " . $org_options['contact_email'] . "\r\n"; | |
| $headers .= "Reply-To: " . $org_options['contact_email'] . "\r\n"; | |
| } | |
| //$headers .= "Content-Type: text/html; charset=utf-8\r\n"; | |
| if (!function_exists('ee_set_html_content_type')) { | |
| function ee_set_html_content_type() { | |
| return 'text/html'; | |
| } | |
| } | |
| add_filter( 'wp_mail_content_type', 'ee_set_html_content_type' ); | |
| return wp_mail($send_to, stripslashes_deep(html_entity_decode($email_subject, ENT_QUOTES, "UTF-8")), stripslashes_deep(html_entity_decode(wpautop($email_body), ENT_QUOTES, "UTF-8")), $headers); | |
| remove_filter( 'wp_mail_content_type', 'ee_set_html_content_type' ); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment