Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling double quotes in mailto:

I am working on Visual Studio 2008 and ASP.net.. I want to preview email that is created in the web page. I have problems in handling double quotes in the email body.

string emailbody = "\"some text\"";

btPreviewEmail.OnClientClick = "javascript:location.href='mailto:?subject=Chalk Pushcast Software Order Agreement&body=" + emailbody + "';";

I have left the recipient's field blank because I just have to preview the email.

At runtime, I get a Microsoft Outlook error like, "The command line argument is not valid. Verify the switch you are using"

like image 607
Pavithra Jayakumar Avatar asked Nov 19 '10 18:11

Pavithra Jayakumar


People also ask

How do you handle double quotes?

If you need to use the double quote inside the string, you can use the backslash character. Notice how the backslash in the second line is used to escape the double quote characters. And the single quote can be used without a backslash.

How do you mention double quotes in a string?

To place quotation marks in a string in your code In Visual Basic, insert two quotation marks in a row as an embedded quotation mark. In Visual C# and Visual C++, insert the escape sequence \" as an embedded quotation mark.


1 Answers

It looks like you need to put them on the url, so you can simply URL encode them (to %22):

string emailbody = "%22some text%22";
like image 104
Oded Avatar answered Oct 17 '22 06:10

Oded