可以使用JavaScript创建客户端电子邮件吗? [英] Can I use JavaScript to create a client side email?

查看:151
本文介绍了可以使用JavaScript创建客户端电子邮件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建客户端邮件创建者网页。我知道在html表单中使用mailto操作的问题(不是标准的,客户端上没有默认的邮件应用程序)。但是网页不是很重要,他们并不在意。

I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.

mailto动作创建的邮件具有以下语法:

The mail created by the mailto action has the syntax:


主题:未定义的主题

正文:

subject: undefined subject
body:

param1 = value1

param2 = value2







paramn = valuen

param1=value1
param2=value2
.
.
.
paramn=valuen

我可以使用JavaScript格式化邮件吗?

Can I use JavaScript to format the mail like this?


主题: XXXXX

Subject:XXXXX

正文:
Value1; Value2; Value3 ... ValueN

Body: Value1;Value2;Value3...ValueN


推荐答案

我们在projet中使用的是一个弹出窗口,打开一个mailto:link,这是我们发现在默认邮件客户端中编写邮件的唯一方法所有邮件客户端(至少我们所有的客户端都使用)。

What we used in a projet is a popup window that opens a mailto: link, it is the only way we found to compose a mail within the default mail client that works with all mail clients (at least all our clients used).

var addresses = "";//between the speech mark goes the receptient. Seperate addresses with a ;
var body = ""//write the message text between the speech marks or put a variable in the place of the speech marks
var subject = ""//between the speech marks goes the subject of the message
var href = "mailto:" + addresses + "?"
         + "subject=" + subject + "&"
         + "body=" + body;
var wndMail;
wndMail = window.open(href, "_blank", "scrollbars=yes,resizable=yes,width=10,height=10");
if(wndMail)
{
    wndMail.close();    
}

这篇关于可以使用JavaScript创建客户端电子邮件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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