Reputation: 1959
I need to add some URLS to pdfs inside my email body
Outlook can create clickable (ctrl+right click) links inside the body. The problem is that if I have spaces in the pdf name the URL breaks.
Here is the html generated in my app. The problem is only with the Spaces inside url. I was trying to replace URLs spaces server side with '%20' but this also didn't help.
<a href="mailto:;[email protected];?Subject=SomeSubject&body=http://someUrl/File%20name%202015-05-21%2011-21-08.pdf%0D%0A%0D%0A" title="title" class="btn">Send email</a>
Clickable URL will break on the first space:
http://someUrl/File...
Is there anyway to encode urls so outlook will create proper links inside the body ?
Cheers!
Upvotes: 4
Views: 3669
Reputation: 322
Simple Way to achieve this is to call js encodeUrl()
twice
encodeUrl(encodeUrl(url))
Upvotes: 0
Reputation: 943185
You can't have spaces in URLs so you must encode the space in the filename in order to create a URL to the file.
mailto:
URLs are URLs so an encoded space will be converted back to a regular space when it is parsed. When inserting one URL into an other, you must encode all the special characters in the nested URL (i.e. you need to convert the %
characters to %25
).
Upvotes: 3