Home › Forums › Calendar Products › Events Calendar PRO › Calendar plugin breaks wordpress emails by forcing contenttype text/html
- This topic has 4 replies, 4 voices, and was last updated 8 years, 7 months ago by
Victor.
-
AuthorPosts
-
June 26, 2016 at 7:28 am #1132084
Jonathan Appleton
ParticipantHi
Since installing your events calendar and pro I noticed that ALL emails sent out by wordpress lost their formatting eg (wordfence logins, wordfence warnings) and the WP password reset emails have lost all line breaks and the password reset url/link is not included as it forces <> either end which gmail hides.I’ve been investigating and found the issue in your plugin file:
/wp-content/plugins/the-events-calendar/vendor/tickets/src/Tribe/Tickets_Handler.php
You are adding a filer to wp_mail_content_type but you are not removing that filer after sending the email!
All other plugins Ive scanned eg Wordfence and Broken link checker both have the add_filter and then after their code executes they have the remove-filter to set it back to plain text emails.
LINE 450
add_filter( ‘wp_mail_content_type’, array( $this, ‘set_contenttype’ ) );
if ( ! wp_mail( $email, sprintf( esc_html__( ‘Attendee List for: %s’, ‘event-tickets’ ), $event->post_title ), $content ) ) {
$error->add( ’email-error’, esc_html__( ‘Error when sending the email’, ‘event-tickets’ ), array( ‘type’ => ‘general’ ) );return $error;
}return esc_html__( ‘Email sent successfully!’, ‘event-tickets’ );
}/**
* Sets the content type for the attendees to email functionality.
* Allows for sending an HTML email.
*
* @param $content_type
*
* @return string
*/
public function set_contenttype( $content_type ) {
return ‘text/html’;
}June 26, 2016 at 8:33 am #1132089Jonathan Appleton
ParticipantHi
I found out that the theme we are using called Kids Planet was setting the mail format to html in its functions file so changing that function fixed our problem. I realised that after disabling all plugins and the problem still persisted!
So all ok for now but please do check your code and hopefully you have the remove-filter in there somewhere too to avoid setting it globally?
Jonathan
June 27, 2016 at 8:33 am #1132349George
ParticipantHey Jonathan,
Thank you for reaching out about this. I’m sorry for the trouble and appreciate your highlighting of this fact about our plugins:
I’ve been investigating and found the issue in your plugin file:
/wp-content/plugins/the-events-calendar/vendor/tickets/src/Tribe/Tickets_Handler.php
You are adding a filer to wp_mail_content_type but you are not removing that filer after sending the email!
☝️ I think you are correct that we should be un-hooking that filter, and I have gone ahead and made a bug ticket for our developers to investigate—and hopefully fix—this issue some time in the not-too-distant future.
Thank you! And please open a new thread any time if other issues or questions arise.
Sincerely,
GeorgeSeptember 21, 2017 at 11:04 am #1352882Victor
MemberHi Jonathan!
Just wanted to share with you that a new maintenance release (for the Week of 18 September 2017) is out, including a fix for this issue 🙂
Find out more about this release → https://theeventscalendar.com/maintenance-release-week-18-september-2017/
Please update the plugins and see if the fix works for your site. Don’t hesitate to open a new topic if anything comes up.
Best,
Victor -
AuthorPosts
- The topic ‘Calendar plugin breaks wordpress emails by forcing contenttype text/html’ is closed to new replies.
