wrote:
> On Nov 1, 7:24 pm, Geoffrey Summerhayes <sumr...@gmail.com> wrote:
>> On Nov 1, 12:41 pm, edwardw...@googlemail.com wrote:
>>> ASP.NET
>>> I have a function on my aspx page to format an email message and send
>>> it. The function is below.
>>> The problem is that I want the body to be formatted with CR/LF -
>>> newlines - between the CS No, the Customer Reference No. and the
>>> body. E.g.
>>> CSNo: ABC123
>>> Customer Ref: 321321
>>> This is the body of the text
>> .href="mailto:"+oEmailAddress+"?subject="+escape(o Subject)
>> +"&body="+escape(oBody);
>
> Thanks Geoff, that worked a treat!
However, the standards compliant UTF-8-safe encodeURIComponent() instead
of the proprietary escape() is recommended here. And using `mailto:' is
recommended against because it is unreliable, especially as you have
ASP(.NET) available to provide for a reliable server-side mailer.
....location = [
"mailer.aspx?to=", encodeURIComponent(oEmailAddress),
"&subject=", encodeURIComponent(oSubject),
"&body=", encodeURIComponent(oBody)
].join("");
Or, even better, let the user submit a form like this:
<form action="mailer.aspx" method="POST" ...>
<input name="email" ...>
<input name="subject" ...>
<textarea name="msgbody" ...></textarea>
<input type="submit" ...>
</form>
No client-side scripting will be required then, although you could use the
`onsubmit' intrinsic event handler attribute to provide for client-side form
validation where it is supported.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>