0

Our app requires an email be sent to a formatted address for tracking purposes the format required to be sent to the mail client is like this:

<a href="mailto\:David Contact<{contactId=2} {userId=2} {pitchingInitiativeId=9}@mail.com>" target="_blank">

In my template I format the href string like this...

mailto:{{contact.name}}<{contactId={{contact.contactId}}} {userId={{userId}}} {pitchingInitiativeId={{pitchingInitiativeId}}}@propelmymail.com>

This results in a mailto link that is formatted like this:

mailto:Reporter%3C%7BcontactId=1%7D%20%7BuserId=7%7D%20%7BpitchingInitiativeId=21%[email protected]%3E

Which is obviously not correct. How do I fix this so a mailto link is formatted correctly? I believe that there is a general understanding that special characters are dangerous in URLS, but in this case it's the requirement. I guess I have just never learned how to escape them or mark them as safe.

1 Answer 1

1

Which Characters Are Allowed in URLs?

Not all special characters will cause an issue in your URLs. There are many safe characters. Other non-safe characters risk poor readability, breaking some browsers and causing issues for crawlers.

Safe characters Standard characters:

0 1 2 3 4 5 6 7 8 9 a b c d e f g h I j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Special characters:

$ – _ . + ! * ‘ ( ) ,

From: https://www.abramillar.com/2018/01/15/special-characters-short-words-urls/

Also take a look at - Uniform Resource Identifier (URI): Generic Syntax


It is per design that you shouldn't be allowed to parse in other characters.

What I would suggest is to put in whatever you need to track, into the title or email body.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.