Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Url Formula to Emcode Mailto:

Topic Labels: Formulas
2202 1
Showing results for 
Search instead for 
Did you mean: 

Hi All,
I am trying to create a Email Link formula
where “EmailAllStaff” is a rollup and “NamesAllStaff” is a lookup.
this should be a strait forward thing to do but i am somhow stuck :slightly_smiling_face:
i must be missing something obvious




1 Reply 1

When adding the contents of fields to a string in a formula, you don’t just put the field names inside the string. You have to concatenate the pieces together, like this:

"Literal string" & {Field Name} & "Another literal string" & {Field name}

You said that {EmailAllStaff} is a rollup field, but didn’t mention the aggregation formula that you’re using. To be compatible with the mailto URL you’re building, you’ll need commas separating your email addresses, but no spaces. With that in mind, I suggest using this aggregation formula:

ARRAYJOIN(values, ",")

The lookup field will also output an array, so you’ll need to also join those using ARRAYJOIN() in your formula.

I’m seeing a bunch of extraneous spaces around various pieces of your mailto URL. Extra spaces in a URL can cause problems, so I stripped those out.

Finally, whenever you want to pass any non-alphanumeric characters via a mailto URL—like for the email body or subject—they need to be properly encoded, which means you’ll need to wrap those strings inside the ENCODE_URL_COMPONENT() function.

With all of that in mind, here’s your sample URL formula with those changes in place:

"mailto:" & {EmailAllStaff} 
& "?subject=" & ENCODE_URL_COMPONENT("Subject line goes here")
& "&body=" & ENCODE_URL_COMPONENT("Body starts here.\n\nGreetings to ")
& ENCODE_URL_COMPONENT("! I hope you're all doing well. Etc. ...")