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"
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.
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.
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";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With