• Resolved iokagr

    (@iokagr)


    HTML in e-mail notifications is not supported. Am I correct, or do I miss something? It would be nice if we could create nicer looking emails for booking/canceling an appointment using HTML tags, e.g., a, img, etc.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello there!

    ​This is currently not supported by this plugin, but it’s on our to-do list for future releases.

    ​We have some customers who use the Email Templates plugin:
    https://wordpress.org/plugins/email-templates/

    I believe it’s compatible with our notification system (it should affect any email sent via WordPress). It has options to add your logo, colors, and other styling options.

    ​We’re always happy to hear any suggestions or feedback you have, let us know if there’s anything else you’d like to see in the plugin 🙂
    ​Thanks,
    ​Natalie G

    Thread Starter iokagr

    (@iokagr)

    Hello Natalie,

    appreciate your quick response!

    ​We have some customers who use the Email Templates plugin:
    https://wordpress.org/plugins/email-templates/

    I believe it’s compatible with our notification system (it should affect any email sent via WordPress). It has options to add your logo, colors, and other styling options.

    Yes, this plugin is useful for styling your e-mails in general. However, it does not provide custom placeholders that I can use in my different appointment templates. In my case, I want to add different links into my booking/canceling e-mails.

    I think, the most trivial (but worst) solution I can use so far is to modify the ssa_wp_mail function inside includes/class-notifications.php. In my booking template, I may have a placeholder like %magic_booking_link%. Then, to render it, I modify the function as follows:

    
    ...
    add_filter( 'wp_mail_from_name', array( $this, 'get_ssa_from_name' ) );
    		
    $message = str_replace("%magic_booking_link%", "This is my <a href='magic.com'>magic</a> link", $message);
    
    wp_mail( $to, $subject, $message, $headers, $attachments );
    remove_filter( 'wp_mail_from_name', array( $this, 'get_ssa_from_name' ) );
    ...
    

    Hope HTML will be supported in future releases.

    Best regards

    Hello!

    If you’re interested in some custom templating, you might be interested in this Twig documentation, here: https://simplyscheduleappointments.com/document/using-twig-2-in-email-notifications/

    Would the links you send out be custom for each email? Or is it the same static link?

    Thanks,
    Natalie G

    Thread Starter iokagr

    (@iokagr)

    Hey,

    no, that’s not what I want. What I really want is that my HTML won’t become escaped in emails. I want to be able to customize my templates with different HTML content.

    Right now, when I enter HTML in a template, the plugin escapes HTML tags in emails so that they appear as normal next. This might be either a bug. Or, a security feature that the customer didn’t request since she’s the one who enters HTML in emails. Twig’s autounescape feature doesn’t work either.

    What confuses me more is that the plugin sets the content-type of emails in the header correctly to text/html but it escapes HTML content… that’s why I mentioned bug.

    So, I found a way to solve that issue for me (didn’t want to analyse the whole code to find out where to disable autoescspe for HTML). At the end, I insert a placeholder in my template wherever I want my HTML content to be placed, let’s say %html_booking% in booking. And this placeholder is replaced right before the email is sent with my actual HTML content (see above code). Since content is replaced right before the email is sent via WP’s mail function, my HTML content won’t become escaped anymore.

    Best regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HTML support in e-mail notifications’ is closed to new replies.