Search code examples
phphtmlemailinfusionsoft

send HTML markup from Custom Field to the Email Campaign


I have an E-commerce website and is integrated to InfusionSoft

What currently happening is that...

Customer completes an order on my website and purchases, let say 2 products.

Upon Order Completion, Order Received tag is added and customer's info is added to InfusionSoft, and the Order Detail HTML Markup (which is generated on my website via code) is added to a Custom Field, ~_myCustomField~

There is already a campaign running which send simple Thank You Email to customer.

What I want is that I can send the Order Detail(which is stored in ~_myCustomField~) along with the Thank You Email

What I have tried that, I have added the custom field into Campaign's Email just like ~Contact._myCustomField~ but it sends the only HTML, not generated one!

_myCustomField contains for example

<table>
  <tr>
     <td>This is your order detail</td>
  </tr>
</table>

Solution

  • Instead of saving the HTML into a custom field, you can just send the thank you email at that point.

    You can use the email service to send an email: https://developer.infusionsoft.com/docs/read/Email_Service

    example:

    $title = "template API test";
    $category = "API Category";
    $fromAddress = "from@infusionsoft.com";
    $toAddress = "~Contact.Email~";
    $ccAddress = "";
    $bccAddresses = "";
    $subject = "My Fancy Subject Line";
    $textBody = "This is the text email body";
    $htmlBody = "HTML"
    $contentType = "Contact";
    $mergeContext = "";
    $tmpId = $app->addEmailTemplate($title, $category, $fromAddress, $toAddress, $ccAddress, $bccAddresses, $subject, $textBody, $htmlBody, $contentType, $mergeContext);
    

    If you want to keep the interaction with the campaign, you can use the goal feature. Learn more about goals here.

    You will be after the funnel service to see if a goal has been completed (such as an order) and send the Thank you email at that point.