Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddypress mails get sent text-only


  • fidelleon
    Participant

    @fidelleon

    WordPress 4.5.1
    BuddyPress 2.5.1
    Geodirectory framework and Geodirectory’s Modern theme.

    Buddypress mails get sent but only using the plain text version. I have modified one of the templates with different wording for HTML and plain text, and no matter what, the system always send the plain text version, so it seems like some part of the system is deciding to just take such version.

    My WordPress instance doesn’t have (and very likely won’t have) a local SMTP server so I’m using “Easy WP SMTP” to communicate with Google servers. I also use BP Registration Options to get account validations.

Viewing 8 replies - 1 through 8 (of 8 total)

  • fidelleon
    Participant

    @fidelleon

    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…


    fidelleon
    Participant

    @fidelleon

    … and I’ve been able to remove “Easy WP SMTP” since the machine actually had a local SMTP server. But still text-only.


    art386art
    Participant

    @art386art

    Yes! Easy WP SMTP plugin – Cool Plugin! Google SMTP Super!


    fidelleon
    Participant

    @fidelleon

    “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…


    chavodbharat
    Participant

    @chavodbharat

    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


    shanebp
    Moderator

    @shanebp

    You can open a ticket here. Use the same user name and password that you use for this forum.


    vbnr
    Participant

    @vbnr

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

    anasmokayed
    Participant

    @anasmokayed

    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?

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar