Force Gmail pack to preserve vertical white space with Format() Formula

Simple situation: You want to add a “Send Email” or “Draft Email” button to a table, and you want the content of the email to come from a cell.

Problem: the Gmail pack collapses vertical white space. E.g.

Hi Brian,

I’m just writing to follow up.

Love,
Mom

becomes

Hi Brian, I’m just writing to follow up. Love, Mom

Solution: you can force the Gmail pack to preserve the paragraph breaks by adding a numbered or unordered list.

Hi Brian,

I’m just writing to follow up.

Love,
Mom

  1. Wash your socks
  2. Wash your hair

Slightly more complicated situation: you want to send emails from each row of a cell, and you want those emails to be automatically generated from a template.

Solution: Make a template. Put a numbered or unordered list in your template. Use the Format() formula to call the template.

If you put the template in a table, as I do in the example below, you can’t put any rows below the first, or the Format() formula gets confused.

Here’s an example table of a document that generates follow-up emails to leads:

2 Likes

Cool hack; good to know.

But, are we absolutely certain the Gmail pack collapses (i.e., sanitizes) the message content?

I have not tested this, but shouldn’t the email message composed by the Gmail pack include both a payload that’s sanitized (i.e., thisMessage.getPlainBody()) and one that includes an HTML rendition of the message payload? (i.e., thisMessage.getBody())

I don’t know what that means! I’m not a developer. All I know is that when I try to send emails from rows as in my example doc, the content gets collapsed unless I add a list.

Collapsed by what exactly? The email client? Or, are you reading the messages that are sent with something beside’s Gmail?

… unless I add a list.

Hmmm… this is an interesting clue. I wonder if the mere existence of any HTML tag anywhere in the text triggers the Gmail pack to transform the entire message’s formatting attributes (i.e., converting newline characters into HTML
tags, etc). If that were true, you should be able to just concatenate “
” to the end of any message and it should work without going to the messy trouble of adding list elements, etc.

There’s no debate, however – the Gmail pack certainly exhibits some odd formatting nuances. But my question is to understand if what we see is actually what’s happening in the email message. Or, are we seeing only part of the picture (i.e., the Gmail pack and/or Coda itself may be obscuring the true nature of the SMTP message payload).

In my view - whatever the Gmail pack is given to send, it should send that content in HTML format representing newlines and everything as well as the plain text version. I can’t imagine the Gmail pack authors failed to recognize this basic requirement, so I’m wondering if indeed, both plain text and formatted versions of the Coda-based content are conveyed in the message.

Such a pack extension should also send the content as plain text because - well - this is an SMTP standard that was implemented back when most of the users here were in grade school. :wink: Plain text payloads are intended to support email clients that cannot interpret HTML, a rarity, but still exists in the wild.