Trouble with plain-text version of emails sent with {{*}} content

Rob Morris's Avatar

Rob Morris

11 Mar, 2016 03:48 PM

We have a few email templates that use the {{*}} star notation to allow us to generate custom HTML and embed it in outgoing emails using the 'content' param. This has always worked well for us.

However, in the past few days, we've run into an issue where the HTML version of an email works fine, but the {{*}} in the plain text part of the email is blank (using the API to post). I thought that should work?

For now, we just removed the plain text content in the template entirely, which is forcing a simplified version of the HTML in, which will work. Is this the best solution?

Thanks!

  1. Support Staff 1 Posted by Scott Tadman on 11 Mar, 2016 05:36 PM

    Scott Tadman's Avatar

    That should work as you're describing, but if that isn't the case I can help to figure out why. Do you have a link to an example message where this problem occurred? The email address you're using here isn't registered to any account I can find.

  2. 2 Posted by Rob Morris on 11 Mar, 2016 06:07 PM

    Rob Morris's Avatar

    Hey Scott, the account is under [email blocked], here's a sample message:

    https://lexercise.postageapp.com/projects/1440/messages/196339953/transmissions/569135086

    Note the content in the HTML version, and nothing but the footer in the plain text. The template used was "admin" in our account, though as I mentioned, I removed everything from the plain text version of that template so our automation could pick up on the HTML version until we sort out why {{*}} isn't working.

  3. Support Staff 3 Posted by Scott Tadman on 11 Mar, 2016 06:23 PM

    Scott Tadman's Avatar

    The {{*}} tag is used to indicate where nested content should go, so that's intended to go in your layout. The API call you've made also includes a nested content tag but that seems out of place.

    If you supply content via the API and also specify a template the final message should have your API content wrapped within your template, using it as a layout, inserting the API content in place of the {{*}} tag. This happens independently for HTML and text.

    It looks like your HTML did get nested correctly, but I'm not sure of your intent for including {{*}} in the API call. What are you trying to position there?

  4. 4 Posted by Rob Morris on 11 Mar, 2016 06:29 PM

    Rob Morris's Avatar

    My understanding is that {{*}} can be used to take in arbitrary content from an API call and embed it in a template using the 'content' variable:

    http://help.postageapp.com/kb/application-features/message-templates#nesting-message-content-from-an-api-call-in-a-message-template-

    Which made sense to me in trying to build a generic "internal email" template that could be used for content that needed to vary widely and wasn't suited to variable substitution. It would be possible to change my API calls to send 'content_html' and 'content_text' explicitly, doing the HTML tag stripping on my end and updating my admin template to use the proper variable. I can move to that route if what I've been doing wasn't appropriate. Thoughts?

  5. Support Staff 5 Posted by Scott Tadman on 11 Mar, 2016 06:32 PM

    Scott Tadman's Avatar

    That's right. Using {{*}} in a template makes it a layout that can embed other content. What I'm speaking to is the use of {{*}} in the content supplied you via the API, so I want to better understand what you're trying to do there.

    Any variables you supply will be substituted not just in the API content, but in the layout content as well. That is, the content is properly nested and expanded, and then variable substitution occurs for the resulting combined form. Generally that's not really a concern, it all happens in the background, but that's a more specific description of the mechanics involved.

  6. 6 Posted by Rob Morris on 11 Mar, 2016 06:38 PM

    Rob Morris's Avatar

    To be clear, the 'content' variable didn't *contain* "{{*}}", it was just plain old html & text. I understand that the general purpose of the {{*}} bit is for building layouts, and that what I'm doing is a bit odd. :-)

    I guess my main question is, how is {{*}} expanded in API calls that send in a 'content' variable? It seemed to me it should be expanded similarly in both HTML and plain text (with a tag stripping step for the plain text expansion). I believe at one point it was in fact working that way! But what I'm seeing is that it expands correctly in HTML, but expands to an empty "" in plain text.

Discussions are closed to public comments.
If you need help with PostageApp please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

10 Mar, 2017 11:34 AM
09 Mar, 2017 01:23 PM
02 Feb, 2017 08:33 PM
10 Jan, 2017 02:28 PM
06 Jan, 2017 09:54 PM