AI Assistant
Notifications
Clear all

[Closed] Change the content type of emails

4 Posts
2 Users
0 Reactions
3,306 Views
arcticsolutions
Posts: 22
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@arcticsolutions)
Eminent Member
Joined: 8 years ago
[#6527]

Hello..

I am using WP Better Emails to add html templates to my emails and got a problem with your plugins emails as they are set to text/html using the filter add_filter( 'wp_mail_content_type', 'wpforo_set_html_content_type' );

WB better emails require content type text/plain before it wrap the html template to the email.

I can not use the same filter as i then get conflict with other plugins i am using unless you have / know any condition i can set in my filter function to check that the email actually is from wpForo or other of your addons.

Something like this:

add_filter( 'wp_mail_content_type', 'aws_wpforo_set_html_content_type', 11 );

function aws_wpforo_set_html_content_type() {
       if ( wpForo ) {
	return 'text/plain';
       } 
} 

Thanks
Rune


3 Replies
1 Reply
arcticsolutions
(@arcticsolutions)
Joined: 8 years ago

Eminent Member
Posts: 22
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

I did find your function in wpf-hooks.php line 915, so if you could change that function to something as below it would be easy to hook into it with our own content type.

function wpforo_set_html_content_type(){
	$content_type = apply_filters('wpforo_emails_content_type', 'text/html');
	return $content_type;
} 

Thanks
Rune


Robert
Posts: 10708
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

Ok, it's done. You can use this hook in next version.


arcticsolutions
Posts: 22
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@arcticsolutions)
Eminent Member
Joined: 8 years ago

Thanks a lot 🙂

Rune


Share: