Send email over URL using Marketo forms | Community
Skip to main content
RaulEr
New Participant
September 19, 2023
Solved

Send email over URL using Marketo forms

  • September 19, 2023
  • 2 replies
  • 2107 views

Hi,

 

I tried to use Marketo tokens in the follow-up URL but it seems it only allows my.tokens. And since we can't use tokens inside tokens.

 

Is there a way I can send the email of a person in the follow-up URL, like https://www.google.com/?email=aaa@bbb.com

 

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Darshil_Shah1

Just use the email script token for this. Make sure you output the fully formed hyperlink (<a> through </a>) from the email script token instead of outputting the URL (https://www.google.com/?email=aaa@bbb.com) alone.

 

<a href="https://www.google.com?email=${esc.url($lead.Email)}">ABC</a>

 

Also, just putting it out here that I'm not a fan of putting PII in the URL. Is there any alternate way you could avoid this?

 

Edit- This solution applies for including Email Address in the URL within an email asset.

2 replies

SanfordWhiteman
New Participant
September 19, 2023

I assume you don’t mean “send” (as in sending a separate email) but actually “append to the query string”, correct?

 

This is simple:

MktoForms2.whenReady(function(readyForm){ readyForm.onSuccess(function(submittedValues, originalThankYouHref){ const thankYouURL = new URL(originalThankYouHref); thankYouURL.searchParams.set("email", submittedValues.Email); document.location.href = thankYouURL.href; return false; }); });

 

I share Darshil’s misgivings about include PII in the URL but if your destination page requires it there’s no avoiding it.

RaulEr
RaulErAuthor
New Participant
September 19, 2023

Yeah that "Send" was to append the value to the query string, thanks Sanford!

oh javascript solution! Nice, thanks!

Darshil_Shah1
Darshil_Shah1Accepted solution
Community Manager
September 19, 2023

Just use the email script token for this. Make sure you output the fully formed hyperlink (<a> through </a>) from the email script token instead of outputting the URL (https://www.google.com/?email=aaa@bbb.com) alone.

 

<a href="https://www.google.com?email=${esc.url($lead.Email)}">ABC</a>

 

Also, just putting it out here that I'm not a fan of putting PII in the URL. Is there any alternate way you could avoid this?

 

Edit- This solution applies for including Email Address in the URL within an email asset.

RaulEr
RaulErAuthor
New Participant
September 19, 2023

Thanks Darshil, that helps a lot and believe me, we didn't want to do this, but we are having issues with Heap to recognize email, so our workaround for now will be doing this.