网页javascript提交outLook发送邮件

    技术2022-05-11  113

    <script type="text/javascript">function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>   网页Javascript提交OutLook发送邮件 < html > < head > < meta  http-equiv ="Content-Type"  content ="text/html; charset=gb2312"   /> < title > 网页Javascript提交OutLook发送邮件 </ title > </ head > < script  language ="javascript" > function toOutLook(){  var objFrm = document.frmEmail;    var objFrmOutLook = document.frmEmailOutLook;    var msg = "";    msg += "姓名: " + objFrm.name.value + "  ";    msg += "电话: " + objFrm.phone.value + "  ";    msg += "网址: " + objFrm.website.value + "  ";    msg += "主题: " + objFrm.subject.value + "  ";    msg += "内容: " + objFrm.message.value + "  ";    objFrmOutLook.message.value = msg;    objFrmOutLook.action = "mailto:sundysea@hotmail.com?subject=" + objFrm.subject.value;    objFrmOutLook.submit();} </ script > < body > < form  name ="frmEmailOutLook"  action =""  method ="post"  enctype ="text/plain" >    < input  type ="hidden"  name ="message"  value ="" > </ form > < form  name ="frmEmail"  action =""  method ="post" > 姓名: < input  type ="text"  name ="name"  value ="a" >< BR > 电话: < input  type ="text"  name ="phone"  value ="b" >< BR > 网址: < input  type ="text"  name ="website"  value ="c" >< BR > 主题: < input  type ="text"  name ="subject"  value ="d" >< BR > 内容: < textarea  name ="message"   > eeddd </ textarea >< BR > < input  type ="button"  name ="send"  value ="send"  onClick ="toOutLook()" > </ form > </ body > </ html >

    点击Send发送之后的内容为

    ----------------------------------------收件人: sundysea@hotmail.com主题: d

    message=姓名: a 电话: b 网址: c 主题: d 内容: eeddd  ----------------------------------------

    注意的几个地方:

    默认发送格式为表单名称=内容.所以在上面我做了两个表单,先组合好内容,然后发送,这样就只有一个表单,而且内容前面有说明(表单的说明)

    表单的属性设置,增加enctype="text/plain"(是以文本方式发送),或者 ENCTYPE="multipart/form-data"(是将文本打包成附件**.ATT的附件)<form name="frmEmailOutLook" action="" method="post" enctype="text/plain">

    发送表单action的格式mailto:目的邮件地址?subject=邮件主题&Bcc=转送(不记得了)&cc=抄送(转自 feng_Sundy的专栏 )


    最新回复(0)