Url Formula to Emcode Mailto:

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 :slight_smile:
i must be missing something obvious

thx!

:m:

image

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(ARRAYJOIN({NamesAllStaff}, ", "))
& ENCODE_URL_COMPONENT("! I hope you're all doing well. Etc. ...")
2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.