From what I see, “something” is using post_excerpt instead of post_content but can’t find the code which decides which one to choose…
… and I’ve been able to remove “Easy WP SMTP” since the machine actually had a local SMTP server. But still text-only.
Yes! Easy WP SMTP plugin – Cool Plugin! Google SMTP Super!
“Solution” told here works fine but requires modifying core:
https://buddypress.org/support/topic/2-5-html-email-styling-not-working/
The BP Registration Options plugin forces in some way to send the emails using content_plaintext instead of content_html:
$must_use_wpmail = apply_filters( ‘bp_email_use_wp_mail’, $wp_html_emails || ! $is_default_wpmail );
It gets set to true so:
if ( $must_use_wpmail ) {
[…]
$email->get( ‘content_plaintext’, ‘replace-tokens’ )
If you visit the “Manage Signups” and send an email to the user (reminding to activate their accout), the mail is 100% HTML w/o touching anything…
I have found solutions for html email text
there is some changes in bp_core files :
You can change content type given below path:
\wp-content\plugins\buddypress\bp-core\bp-core-functions.php line number 2962
put content_html text instead content_plaintext:
content_plaintext should be send plain text email and content_html should be
send html email:
$email->get( ‘content_plaintext’, ‘replace-tokens’ )
$email->get( ‘content_html’, ‘replace-tokens’ )
I would like to give suggestions, if buddypress team should be given backend options like select content type (1)HTML email (2)Plain text
because buddypress have not given any hook for changes content type text
You can open a ticket here. Use the same user name and password that you use for this forum.
Hi,
is not necessary to change system files.
Look that code
$wp_html_emails = apply_filters( 'wp_mail_content_type', 'text/plain' ) === 'text/html';
So the right way is just to add filter who returns ‘text/html’
add_filter('wp_mail_content_type', 'text/plain', function () {
return 'text/html';
});
Hi @vbnr!
Would you explain a bit more! Where to add this filter? I tried to add it in \wp-content\plugins\buddypress\bp-core\bp-core-functions.php under the specific code but it doesn’t work!
I even tried the previous solution to replace content_plaintext with content_html and yet users receive emails in plain text.
Would you help me with this?
I found a way to resolve this problem using a mixture of ideas, including the suggestions from @bharat and @vbnr. I’ve put the details in a blog post here. In summary, what worked for me was the following in the bp-custom.php file:
// Set BP to use wp_mail
add_filter( 'bp_email_use_wp_mail', '__return_true' );
// Set messages to HTML
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
add_filter( 'wp_mail_content_type', 'set_html_content_type' );
function set_html_content_type() {
return 'text/html';
}
// Use HTML template
add_filter( 'bp_email_get_content_plaintext', 'get_bp_email_content_plaintext', 10, 4 );
function get_bp_email_content_plaintext( $content = '', $property = 'content_plaintext', $transform = 'replace-tokens', $bp_email ) {
if ( ! did_action( 'bp_send_email' ) ) {
return $content;
}
return $bp_email->get_template( 'add-content' );
}
// Optionally change your email address and from name.
add_filter('wp_mail_from','noreply_from');
function noreply_from($from) {
return 'noreply@YOUR_DOMAIN.org'; //Replace 'YOUR_DOMAIN.org' with email address
}
add_filter('wp_mail_from_name','noreply_from_name');
function noreply_from_name($name) {
return 'YOUR_DOMAIN No-Reply'; //Replace 'YOUR_DOMAIN No-Reply' with the from name
}