Announcement

Collapse
No announcement yet.

How to send HTML email and how to generate the html message body from Email Template

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to send HTML email and how to generate the html message body from Email Template

    Hi,

    We are trying to notify customer with email when his order status changed like cancelled. Unfortunately I can't find this trigger from Template Based Email. So we would like to create a page to send the email.

    We are now trying to use function in this page https://docs.miva.com/api-functions/sendemail, but it seems send text email by default and we can't find how to set the parameter to make it send HTML email. Can anyone let us know how to set it as HTML email? Thank you.

    Besides, we would like to use the template based email to generate the email body for us. Is is possible?

    Any help will be greatly appreciated. Thank you.

    #2
    Just spitballing, but I'd think something like this would work:

    Add your own template, make sure 'Visible for: Orders' is checked.

    When you start editing your template, you'll probably want to add all the same Items as an Order Confirmation email so you have access to things like &mvt:order:whatever;

    Then in Order Processing, when you view an individual order, you can click Order Emails, choose your template, then send them the status changed email that way. You could use further customization by setting up an order custom field that changes the template based on the custom field (e.g., 'cancelled' has a different format than 'delayed') by checking the order custom field within the order template, e.g.,

    HTML Code:
    <mvt:item name="customfields" param="Read_Order( l.settings:order:id, 'order_status', l.settings:order_status )" />
    <mvt:if expr="l.settings:order_status EQ 'cancelled'">
        // template for cancelled emails
    <mvt:elseif expr="l.settings:order_status EQ 'delayed'">
        // template for delayed emails etc.
    </mvt:if>
    or simply set up a template for each of the different scenarios, either way would work I think!

    Comment


      #3
      I haven't looked into this in years, but I believe the preferred method for stores to send emails in multipart (text and HTML simultaneously on one email) format, that way you have the best of both worlds.

      https://gist.github.com/tylermakin/d...8721c7fb1939a8
      Thank you, Bill Davis

      Comment


        #4
        Thank you guys for your help.

        I found some sample code from here and now I'm able to send html email: https://gist.github.com/tessguefen/edc5a8d29d33722bfa84

        I'll continue looking for the way generate content with email template.

        Comment

        Working...
        X