Support » Plugin: WordPress Email Template Designer - WP HTML Mail » Sending Mail via WP_Mail

  • Resolved devop7934

    (@devop7934)


    Do you have an example of compatible mail sending html email (with H tags and inline styling such as bold, strong, underline, etc) via the wp_mail that is compatible with your template system?

    I’m triggering a simple email send via wp_mail in response to a webhook, however body content does not retain any of the original html formatting after template is applied.

    Here are the case scenarios I’ve tested, and there outcomes…

    1) plain text or html formated body -> do not set content type via header or filter –> two email received with template applied to both, but no formatting in body of message.

    2) Set content type to text/plain via header and filter. Format email as plain text with “\r\n” as end of line –> One email received with template applied. Body is basic formatted like plain text but wrapped in html template. Header image alignment changed from center to left. header text remains centred.

    3) Set Content type to text/html via mail header and filter. Format mail message with HTML tags –> One email received with template applied. Body is stripped of all html formatting and appears as single continuous text block wrapped in html template. Header image alignment changed from center to left. Header text remains centred.

    Notes: It looks like header image alignment issues are specific to some mail platforms like outlook.com. The same emails in ZOHO or GMail appear to keep header image and body column/div width properties. However, in all clients the body content formatting is the same.

    No mater what I try I can not get html formatting of the body to “transfer” to the body content with template applied.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support juliangk

    (@juliangk)

    @devop7934

    Hello,

    for sending e-mail you could use this plugin “Post SMTP Mailer/Email Log”
    We recommend a SMTP plugin.

    Are you using any other plugins, that are related to e-mails? There could be an incompatibility issue.

    Best regards
    Julian

    Thread Starter devop7934

    (@devop7934)

    OK… I’ve resolved this issue.

    Answers to question….

    Only one other mail related plugin (Zoho Mail- witch uses Oauth to send via smtp) is installed.

    All form plugins and those shipped with the theme were disabled with the original tests.

    The issue…

    When testing HTML is was only using html </br> tags for line breaks…. rather than full formatting. It appears these are stripped. If changed to old style <br> without the backslash they are not stripped. I have now added more detailed HTML mark-up and changed Content-type in header and add filter to text/html.

    Everything appears to work correctly now with display in outlook and Zoho mail clients reflecting desired outcome.

    I do not know if the striping of </br> is occurring in your plugin, Zoho mail plugin or the end email client. But I have a working solution…

    Hope this helps someone else battling format/display

    Thread Starter devop7934

    (@devop7934)

    I’ve looked into this further and can confirm the </br> format of the <br> tag appears to be a more widespread issue for mail clients. As stated above <br> without a slash works for me in limited test scenarios, however it is possible a <br/> or <br /> may work too.

    Further reading: https://stackoverflow.com/questions/23760210/how-to-use-the-brtag-in-email-content

    Plugin Support juliangk

    (@juliangk)

    Hello @devop7934 ,

    I am glad you managed to resolve this issue.
    Thank you as well, for your input, it is very much appreciated.

    If you have any further issues, let us know.

    Best regards

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