Help

The Community will be temporarily unavailable starting on Friday February 28. Weā€™ll be back as soon as we can! To learn more, check out our Announcements blog post.

Re: Email multiple users from Button field

3743 0
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
Kamille_Parks
16 - Uranus
16 - Uranus

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

Noah
6 - Interface Innovator
6 - Interface Innovator

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.

Noah
6 - Interface Innovator
6 - Interface Innovator

@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})
Noah
6 - Interface Innovator
6 - Interface Innovator

@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.

Noah
6 - Interface Innovator
6 - Interface Innovator

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

Noah
6 - Interface Innovator
6 - Interface Innovator

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.