用asp实现的jmail发送订单邮件代码
来源:
发布时间:2010/5/20
浏览次数:1743
用asp实现的jmail发送订单邮件代码
<%
action=request("action")
if action="ok" then
sendname = trim(Request("123")) '发件人名字
email = trim(Request("email")) '发件人邮箱
zhuti = trim(Request("zhuti"))
body = trim("姓名:"&Request("123")&"<br>"&"电话:"&Request("dtel")&"<br>"&"手机:"&Request("dsj")&"<br>"&"邮编:"&Request("dpost")&"<br>"&"付款方式:"&Request("fk")&"<br>"&"地址:"&Request("ddz")&"<br>"&"产品:"&Request("dp")&"<br>"&"付款:"&Request("way")&"<br>"&"留言:"&Request("dly"))
'==================================================
' 参数设置开始
smtpserver = "smtp.163.com" '发送邮件所使用的SMTP服务器,例如smtp.163.com
smtpuser = XX '与SMTP服务器对应的邮箱用户名
smtppwd = "xx" '与SMTP服务器对应的邮箱密码
smtpemail = "XX@163.com" 'SMTP服务器发信邮箱
myemail=trim(Request("email")) '用来接收邮件的邮箱,可以与SMTP服务器发信邮箱不同
mail=Request("smtpemail")
' 参数设置结束
'==================================================
if sendname="" or zhuti="" or body="" or Request("dsj")="" or Request("ddz")="" then
response.write "带*号的必须写完整!<a href=javascript:history.go(-1)>返回上一页</a>"
response.end
end if
mailbody=mailbody &"<style>A:visited { TEXT-DECORATION: none }"
mailbody=mailbody &"A:active { TEXT-DECORATION: none }"
mailbody=mailbody &"A:hover { TEXT-DECORATION: underline }"
mailbody=mailbody &"A:link { text-decoration: none;}"
mailbody=mailbody &"BODY { FONT-FAMILY: 宋体; FONT-SIZE: 14px; line-height:24px;}"
mailbody=mailbody &"TD { FONT-FAMILY: 宋体; FONT-SIZE: 14px; line-height:24px;}</style>"
mailbody=mailbody &"<TABLE border=0 width='95%' align=center><TBODY><TR><TD style='font-size:14px;'>"
mailbody=mailbody &"患者<strong>"&sendname&"</strong>的订单内容如下:<br><br>"
mailbody=mailbody &""&body&"<br><br>"
mailbody=mailbody
mailbody=mailbody &"</TD></TR></TBODY></TABLE>"
if sendname <> "" and email <> "" then
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
JMail.ContentType = "text/html"
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = zhuti
jmail.AddRecipient myemail
jmail.Body = mailbody
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd
isgo = jmail.Send(smtpserver)
if isgo then
msg="<div style='width:500px; border:1px dotted #FF0000; background:#FFFFFF; padding:10px; font-size:12px; color:red; line-height:24px; '>提交订单功,我们将及时与您取得联系,如有任何问题请拨打我们服务热线!<br>此订单已经生效,不需要多次提交,谢谢!<a href=javascript:history.go(-1)>返回上一页</a></div>"
else
msg = "发送失败,配置是否正确.<a href=javascript:history.go(-1)>返回上一页</a>"
end if
jmail.Close
set jmail = nothing
end if
end if
%>