Formatted text module

I have a client who wants us to automate emails to clients. These will be semi professional looking emails with header, address boxes, etc. the main body will be a table of multiple rows (generated in the automation from a query). My question, is there a module/assembly that allows you to create any sort of document template to reuse and simply insert data into? Something more than basic text.

Thanks

You might be able to use the XML Builder module, if the email content is HTML and the HTML is well-formed enough to be parsed as valid XML.

ok. I did see the text to pdf module as well and that would work as i could attach it as a file to the email (assuming i could get the text is in the format i need).

“Text to PDF” is an action. Would work well within an automation, if you want to use field mappings to insert values into an overall template.

If on the other hand you need to do the replacements in an assembly, I can help provide a module for you. Would be easy, I can just take the XML Builder module and remove its check for XML syntax validity.

that might work but im not sure how it would work for formatting. say i wanted to have text in the top right corner of a doc, tabled entries, etc. just not sure how to get that to format

Then I would use HTML within the XML Builder module for that kind of email formatting.

so best bet is build it all with all the formatting, etc within the xml builder then either convert that to a doc and attach or write it as the body of an email.

Can you think of anything within the xml builder/xmlrowbuilder that would stop me from doing that? just trying to cover bases before i get going

The HTML will have to be well-formed such that it passes an XML syntax check, that’s the only concern I can think of. Then I would send the emitted HTML as the body of the email.

1 Like

trying the xml builder idea and it appears as if   breaks it. i get an illegal entity character from it. it is part of an html table i am creating to hold data.

I can get around it, just saying for reference that there is one thing that fails.

I can provide a new module that is a copy of the XML Builder that won’t do the XML validation, if that basic module functionality otherwise meets your needs.

i think im ok for now. if i come across any major roadblocks i will let you know.

I was just updating you to know in case someone else tries this or you decide to make a dedicated module

so i have a test version running but i am coming across a bit of an issue and im not sure the actual cause.

I am using the xml builder and row builder to create the html body for the email then sending that through the email module. when i run it through the assembly editor to test, the email looks as i expect, formatted correctly with tables, etc.


But when i run that same thing through the automation, the formatting is all over the place and there are like 20 line spaces between everything. just massive gaps.

Any idea what could be causing that?

Seemingly line break characters are being treated differently in the browser vs on the server.

What is the assembly uuid and the automation number?

c52a09379ab54270879eafe5fec71de8

The email module will automatically replace newlines with HTML line break tags <br/> if the body contains an <html> tag.

I would experiment and format the HTML using just the line break tags <br/> instead of newlines and see if you can get the automation to format the email as desired. Do small tests running the automation to understand what formatting is needed to get the desired results. Or run the assembly on the server with this option:

Running the assembly in the browser can have different results b/c browsers handle HTML characters natively.

ahh. well the xml validation requires the closing </br> to be there. if i try without it then it fails

<br/> by itself is a valid XML node, is equivalent to <br></br>

yeah. that does make sense. ok. i will let you know if it works