Last post Jan 11, 2013 05:54 AM by Pengzhen Song - MSFT
Jan 04, 2013 06:05 PM|jjmonty|LINK
What is the easiest way to encode text to be used in a mailto: link
<a href="mailto:firstname.lastname@example.org?body=[text to be encoded]">
There has got to be an easy way. I tried httputility.urlencode and httputility.htmlencode but nothing works. Surely Microsoft has something that converts this simply...
Jan 04, 2013 07:31 PM|m.koopman|LINK
You were pretty close, you should combine both. First use the UrlEncode method and then use the
HtmlEncode to encode the output of the UrlEncode.
Jan 04, 2013 07:54 PM|jjmonty|LINK
This does not work for me for some reason. Also, I am not trying to construct an HTML email message...thc
Jan 05, 2013 05:57 AM|geniusvishal|LINK
Jan 05, 2013 12:15 PM|m.koopman|LINK
And what if you try something like this:
Jan 07, 2013 02:10 PM|jjmonty|LINK
That worked (!) The problem I was having was due to the length of the body I was trying to send, not the encoding. See the following link:
NEW PROBLEM: OK, so that works but the problem now is that when the user clicks on the button that does the emailing, there is an intermediate window that pops up before the email client is called up. The intermediate window has to be closed by the user
and that is a little cumbersome UI-wise. Is there a way to just click on the email button and call the email client directly without any intermidiate window that a user has to close???
Jan 07, 2013 02:58 PM|jjmonty|LINK
As it happens there is a limit to the size of the url that can be passed to the email client through the browser. I am testing on IE8 where the limit is 2000 characters. Although I got the body encoded, its length is a problem and there doesnt seem to be
a way around it for IE:
Thx for all your help.
Jan 11, 2013 05:54 AM|Pengzhen Song - MSFT|LINK
I suggest you use send email using System.Net.Mail for avoiding the limit to the size.
Hope it can help you.