简体   繁体   English

将用户数据解析为mailto表单的&body属性

[英]Parsing user data into &body attribute of mailto form

I have this script: 我有这个脚本:

function calculate(){

passworda = document.password1.user1.value.toLowerCase()
passwordb = document.password1.pass1.value.toLowerCase()

var user = 1
var pass = 1

for(d=0;d<passwordb.length;d++) {
pass*= passwordb.charCodeAt(d);
}
for(e=0;e< passworda.length; e++) {
user *= passworda.charCodeAt(e);
    }
      document.password1.outputuser1.value = user;
      document.password1.outputpass1.value = pass;
}

and this form: 和这种形式:

<form name="password1" enctype="text/plain" method="get" action="mailto:myemail@mydomain.com?subject=Register&body=A new user has registered with your form. Their username is ' +outputuser1+ ' and their password is ' +outputpass1+ '">
Username:<input type="text" name="user1" />
Password:<input type="password" name="pass1" />
<input type="submit" value="Register" onclick="calculate()" />
<input type="reset" value="Reset" />
</form>

What I want to do is when a user fills out this form and hits submit, it emails me with their encrypted username and password, replacing 我要做的是,当用户填写此表单并点击“提交”时,它会通过电子邮件将其加密的用户名和密码发送给我,

&body=A new user has registered with your form. Their username is ' +outputuser1+ ' and their password is ' +outputpass1+ '"

with

&body=A new user has registered with your form. Their user name is JOHNSMITH and their password is 123456"

when the form gets submitted. 提交表单时。 I'm not getting any javascript errors, but when the email window opens, the body and subject are blank. 我没有收到任何JavaScript错误,但是当电子邮件窗口打开时,正文和主题为空白。

Can anyone help get this working please? 有人可以帮忙吗? Many thanks in advance! 提前谢谢了!

Forms with mailto: uris are too poorly supported for use on the WWW. 带有mailto: uris的表单支持太差,无法在WWW上使用。

If you want to collect data with a form then you need to use an HTTP(S) URI as the action, and process submitted data on the server. 如果要使用表单收集数据,则需要使用HTTP(S)URI作为操作,并在服务器上处理提交的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM