Support » Plugin: WP Mail SMTP by WPForms » Other SMTP won’t send HTML and Plain text email

  • Resolved alexga


    Can I please get some help with “Other SMTP” email option.
    The plugin is unable to send both HTML and Plain text version of the message. At the moment all emails are sent as HTML but that’s not good enough for a good email score.

    I’m working on my own plugin and this is my implementation to to send an email.

    $subject= ‘My subject’;
    $message='<doctype html> content here’;
    $plaintextmsg = ‘my plain text msg using/r/n as line breaks. Is this correct?’;

    function wp_mail_set_text_body($phpmailer) {
    if (empty($phpmailer->AltBody)) {$phpmailer->AltBody = $plaintextmsg;}
    $headers = array( ‘Content-Type: text/html; charset=UTF-8’,’BCC:‘ );
    wp_mail( $email, $subject, $message, $headers );

    What am I doing wrong?
    The issue is marked as resolved in previous tickets but I’m having issues with this still, using latest version of the plugin.


    • This topic was modified 6 months, 1 week ago by alexga.
Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m by no means an expert but does this work for you:

    function wp_email_content_type() {
    return ‘text/html’;

    add_filter( ‘wp_mail_content_type’, ‘wp_email_content_type’ );

    You can then remove filter like this:
    remove_filter( ‘wp_mail_content_type’,’ wp_email_content_type ‘ );

    I need one of the plugin developers to reply here since this is not working.

    Considering this plugin has almost 1M downloads one would think it can perform at least the basic email functions.

    Plugin Support Sanjeev Aryal


    Hi @alexga,

    If you simply use wp_mail() then it will route the email through WP Mail SMTP. If the plugin (or your piece of code) is using the native PHP mail() OR its own phpmailer then it won’t get sent through our plugin. I’m not sure on your purpose to use phpmailer_init action hook, if you’re using it to setup the Other SMTP connection, it might not route the email through WP Mail SMTP.

    If you’re having any error sending a test email with ‘Other SMTP’ within plugin’s settings, please let me know the error printed underneath the error message.

    I hope this helps!

    Hi Sanjev
    I want to route the emails to WP MAIL SMTP and I am using wp_mail function. Can you please provide me with an example that uses wp_mail and enables both HTML and PLAIN Text version of the message to be sent. Keep in mind that my WP MAIL SMTP uses Other SMTP option.


    Plugin Support Sanjeev Aryal


    Hi @alexga,

    If you’re using wp_mail() function, it should route the emails automatically through the WP Mail SMTP, this does not depend on the ‘Other SMTP’ or the mailers you’re using. The content type is ‘text/plain’ by default. For HTML emails, you’ll need to pass the header like: $headers = array('Content-Type: text/html; charset=UTF-8'); or as per @joshbaker described.

    Please follow the docs on wp_mail() for more details. There are tons of examples too.

    If you are still having an issue, please let me know on which action hook you’re using wp_mail() to send the emails.

    I hope this helps!


    I’m using Content-Type: text/html in my header already. The point here is that the Email is sent ONLY as HTML not including the Plain Text version. I want to send both.

    How do I do this?????

    Bump. Can I please get a reply here. Thanks!

    Plugin Support Sanjeev Aryal


    Hi @alexga,

    I apologize for the late response, but I’m not sure what are you trying to achieve. If you mean other content types, please follow the documentation.

    Please note that this support query is not specific to this plugin and is outside the support scope for our free version.




    Hi Sanjeev,

    All I’m trying to achieve is to ensure that every email sent through our plugin actually sends both content type: Html and Plain text. The issues I’m having is that only the HTML part is sent and not the plain text version.

    So if you please advise how would you use the wp_mail function to send both an HTML and a plain text version the mail?

    If your plugin does not support this please say so!

    Plugin Support Jess Quig


    Hi alexga,

    I apologize, however the help you’re looking for is outside of our support scope.

    WP Mail SMTP does not send emails itself (other than basic test emails) — instead, it will simply help improve deliverability of any emails sent out by other services on your site (for example — your theme, other plugins, WordPress core, or your own custom code).

    In case it helps to clarify, though, WP Mail SMTP does support both HTML and plain text emails. So if you’re sending out both of these email types from your site, that’s completely fine — WP Mail SMTP will not prevent this in any way.

    However, we are not able to provide support for the custom code needed to send out those emails. In case it helps, you might consider looking into a custom development service for some extra help with this customization (for example, we generally recommend Codeable for connecting with WordPress-specific developers).

    I hope these extra details help in some way, and that you’re able to get this working how you’d like!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Other SMTP won’t send HTML and Plain text email’ is closed to new replies.