回车邮件正文 [英] Carriage Return Email Body

查看:60
本文介绍了回车邮件正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用javascript预填充电子邮件正文。我无法想象

如何控制文本的carraige返回。标准\\ n是

无效。我可以尝试另一种技术吗?

解决方案

TJO写道:

我试图预先填充使用javascript的电子邮件正文。


现在放弃并为自己省去很多悲伤。

我无法弄清楚如何控制文本的carraige返回。标准\\\\ n无效。


不,这不行。

还有其他技巧可以尝试吗?




提交表格,让服务员发送电子邮件


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq


TJO写道:

我正在尝试使用javascript预填充电子邮件正文。我无法想象如何控制文本的carraige返回。标准\\ nn
无效。我可以尝试另一种技术吗?




兰迪试图说这是非常不可靠的,因为用户可能没有b $ b没有已配置电子邮件客户端,或者它可能不支持mailto的所有

功能。


例如,Lotus Notes不接受超过200的主体

字符,所以虽然你可以在受控的

内联网上使用它,但你不应该在网上使用它。


以下适用于Lotus Notes基于转义原则

的文本(%0A是一个回报):


< a href ='' mailto:ro*@myemail.com?SUBJECT =电子邮件已损坏

行& body =此处%20is%20a%20line%20with%0Aa%20break''>点击

这里发送...< / a>


使用\ n和转义功能的替代方案(如果
也可以使用\r)
更适合):


< a href =''''onclick ="

this.hr ef =''mailto:ro*@myemail.com?SUBJECT =电子邮件形式& body =''

+ escape(''这是'\\\\\\\\\\\\\\\\\ br />
">点击此处发送...< / a>


如上所述,只有轻微测试,当然不适合

网站上说明的原因。

干杯,Rob。


RobG写道:

[...]


< a href =''''onclick ="
this.href =''mailto:ro * @ myemail .com?SUBJECT =电子邮件形式& body =''
+转义(''这是\ na broken\\\
line'');
">点击此处发送... < / a>




你可以通过放置一个有用的href来使JavaScript更加可靠,以防JavaScript没有工作*可以*无论

是否启用JavaScript都可以工作:


< a href =''mailto:ro*@myemail.com?SUBJECT = E -mailform&上午p; body =嗨''

onclick ="

this.href =''mailto:ro*@myemail.com?SUBJECT = E-mailform& body = ''

+ escape(''这是'\ broken\\\
line'');

">点击此处发送...< / a>


使用onclick意味着您可以从textarea或

获得相似的内容。


但是由于Rob说的原因,它可能仍然失败,并且依赖于

JavaScript和mailto有点双重危险


弗雷德。


I am trying to pre populate an email body using javascript. I cannot figure
out how to control the carraige returns for the text. The standard \r\n is
not working. Is there another technique I can try?

解决方案

TJO wrote:

I am trying to pre populate an email body using javascript.
Give up now and save yourself a lot of grief.
I cannot figure out how to control the carraige returns for
the text. The standard \r\n is not working.
Nope, that doesn''t work.
Is there another technique I can try?



Submit a form, let the server send the email

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq


TJO wrote:

I am trying to pre populate an email body using javascript. I cannot figure
out how to control the carraige returns for the text. The standard \r\n is
not working. Is there another technique I can try?



Randy is trying to say that this is very unreliable, as the user may
not have an email client configured, or it may not support all the
features of mailto.

For example, Lotus Notes will not accept a body of more than 200
characters, so whilst you may get away with this on a controlled
intranet, you should not use it on the web.

The following works with Lotus Notes based on the principle of escaping
the text (%0A is a return):

<a href=''mailto:ro*@myemail.com?SUBJECT=E-mail with broken
lines&body=Here%20is%20a%20line%20with%0Aa%20break ''>Click
here to send...</a>

An alternative using \n and the escape function (you can use \r too if
that suits better):

<a href='''' onclick="
this.href=''mailto:ro*@myemail.com?SUBJECT=E-mailform&body=''
+ escape(''This is\na broken\nline'');
">Click here to send...</a>

As noted, only lightly tested and certainly not considered suitable for
the web for the stated reasons.

Cheers, Rob.


RobG wrote:
[...]


<a href='''' onclick="
this.href=''mailto:ro*@myemail.com?SUBJECT=E-mailform&body=''
+ escape(''This is\na broken\nline'');
">Click here to send...</a>



You can make that marginally more reliable in case JavaScript isn''t
working by putting a useful href that *may* work regardless of
whether JavaScript is enabled:

<a href=''mailto:ro*@myemail.com?SUBJECT=E-mailform&body=Hi''
onclick="
this.href=''mailto:ro*@myemail.com?SUBJECT=E-mailform&body=''
+ escape(''This is\na broken\nline'');
">Click here to send...</a>

Using an onclick means you can get the content from a textarea or
similar too.

But it may still fail for the reasons Rob stated, and making it rely on
both JavaScript and mailto is kinda double jeopardy

Fred.


这篇关于回车邮件正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆