G
George Durzi
I'm trying to pop up a mailto: window using server side script, here's how
I'm doing this.
string sBody = string.Concat("Test", @"\", Environment.NewLine, "Test",
@"\", Environment.Newline);
string sSubject = "Test Email";
string sScript = string.Concat(@"window.open('mailto:?subject=", sSubject,
"&body=", sBody, "')");
StringBuilder sbEMNote = new StringBuilder();
sbEMNote.AppendFormat("{0}{1}{2}", @"<script language=javascript>", sScript,
@"</script>");
if (!Page.IsStartupScriptRegistered("EmailIndividualNote"))
Page.RegisterStartupScript("EmailIndividualNote", sbEMNote.ToString());
If I step through my code, sBody looks like this:
Test\\\r\nTest\\\r\n
I had to put the @"\" before the Environment.Newline otherwise JavaScript
gives me an "unterminated string constant" error.
Anyhow, everything works, except the Body of my email contains TestTest. The
crlf was ignored. Any idea why this is happening?
I'm doing this.
string sBody = string.Concat("Test", @"\", Environment.NewLine, "Test",
@"\", Environment.Newline);
string sSubject = "Test Email";
string sScript = string.Concat(@"window.open('mailto:?subject=", sSubject,
"&body=", sBody, "')");
StringBuilder sbEMNote = new StringBuilder();
sbEMNote.AppendFormat("{0}{1}{2}", @"<script language=javascript>", sScript,
@"</script>");
if (!Page.IsStartupScriptRegistered("EmailIndividualNote"))
Page.RegisterStartupScript("EmailIndividualNote", sbEMNote.ToString());
If I step through my code, sBody looks like this:
Test\\\r\nTest\\\r\n
I had to put the @"\" before the Environment.Newline otherwise JavaScript
gives me an "unterminated string constant" error.
Anyhow, everything works, except the Body of my email contains TestTest. The
crlf was ignored. Any idea why this is happening?