Help

Re: Email multiple users from Button field

3368 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Noah
6 - Interface Innovator
6 - Interface Innovator

Hey all,

Just getting to play around with the new button field (it’s awesome) and had a quick question - any idea if it’s possible pull multiple emails into the “To” section of the email?

To explain further, I have two 2 tables within a base: 1 is locations and 1 is contacts. On the locations table, each location has multiple contacts linked it. I’m looking to build a button that when clicked, would include all of the contacts associated to that location into the “To” section of an email.

Appreciate any and all help!

Noah

9 Replies 9

Have you tried using a Rollup field that does an ARRAYUNIQUE() aggregation for the contacts’ emails, and using that to send the emails?

Hi @Kamille_Parks,

Appreciate the response - unless I’m missing something with the formula, this doesn’t work (I’m unable to save). I’ve also tried this same concept with a Lookup but have not had any luck.

Maybe it’s a limitation of the feature?

Thanks,
Noah

To email multiple people using a mailto URL, the email addresses must be separated by commas with no spaces. For example:

mailto:first@example.com,second@example.com

If you share the formula you’re trying to create, we can figure out how to fix it so that it creates the correct output.

@Justin_Barrett
Thanks for taking the time to chime in. The problem I’m having is as follows:
Using the button tool, I am able to copy the email addresses from the Lookup column displaying them and have them inserted into the “to” section of the email - but even though they have commas in Airtable, they are being spit out in the to section without a separator (ie. john@test.comjane@test.com)
I’ve tried using both the Lookup and Rollup columns in this formula (pulling from the same property on the other table) and both spit out the emails without a separator between them.

I’ve included images of the the formula and what the final output looks like:
image
image
image

Any thoughts for a workaround?

Thanks,
Noah

With a rollup field, use the aggregation formula: ARRAYJOIN(values, ",") . That will force a comma between the addresses. The same would work with a lookup field, but this function would need to be part of the button field formula, to process the array from the lookup field.

That aside, I see that you’re trying to insert this into a URL to Gmail. That adds a whole new wrinkle into the process, one which you should’ve mentioned earlier. :winking_face: I thought you were building a standard “mailto” link, not a website URL. With that in mind, you’ll also need to wrap the addresses in ENCODE_URL_COMPONENT() so that the non-alphanumeric symbols are properly encoded for the URL. The same will also need to be done for the other values passed to the URL.

If you use the lookup field shown in your screenshot, then your formula would look like this (broken up on several lines for clarity:

"https://mail.google.com/mail/u/0/?view=cm&to="
& ENCODE_URL_COMPONENT(ARRAYJOIN(Lookup, ","))
& "&su=" & ENCODE_URL_COMPONENT(Address)
& "&body=" & ENCODE_URL_COMPONENT({Floor/Suite})

@Justin_Barrett
This is super helpful - thank you so so much for clarifying in detail. For what it’s worth (and likely because I’m doing something wrong on my end), this button does not work when inserting the ARRAYJOIN function straight into the rollup column aggregation formula (button is greyed out and not clickable) but it works perfectly with the Lookup column (inserting ARRAYJOIN into the button’s URL formula).

The final question on this - I’ve tried using “\n” to skip lines in the & “&body=” section of the button URL but it doesn’t seem to be picking it up. Am I doing something wrong or does the button URL formula not accept line skips?

Thanks again for your continued help!
Noah

Airtable formulas do accept the newline escape code “\n”, but Airtable doesn’t always display them properly in every location. If the record height in your table is only one line, for example, you won’t see newlines.

However, if you’re talking about the newlines not getting through to Gmail, that may be something else. It’s possible that Gmail is expecting HTML instead of plain text, in which case you might try wrapping your paragraphs in standard HTML paragraph tags. I don’t have time at the moment to test this theory, but I’d be interested to hear what you find if you do try it.

Thanks Justin!
I will look into this further as it’s definitely not coming through to Gmail. Will keep you posted.

Hey @Justin_Barrett
Some snooping around and additional guidance from @JonathanBowen led me to the solution here - the “\n” line break code needs to be within the ENCODE_URL_COMPONENT section for the line break action to carry over to Gmail. As I had it, I had closed the parenthesis of that section and included the \n after it.

Appreciate your help here.