用asp實現(xiàn)的jmail發(fā)送訂單郵件代碼
來源:
發(fā)布時間:2010/5/20
瀏覽次數(shù):1740
用asp實現(xiàn)的jmail發(fā)送訂單郵件代碼
<%
action=request("action")
if action="ok" then
sendname = trim(Request("123")) '發(fā)件人名字
email = trim(Request("email")) '發(fā)件人郵箱
zhuti = trim(Request("zhuti"))
body = trim("姓名:"&Request("123")&"<br>"&"電話:"&Request("dtel")&"<br>"&"手機:"&Request("dsj")&"<br>"&"郵編:"&Request("dpost")&"<br>"&"付款方式:"&Request("fk")&"<br>"&"地址:"&Request("ddz")&"<br>"&"產(chǎn)品:"&Request("dp")&"<br>"&"付款:"&Request("way")&"<br>"&"留言:"&Request("dly"))
'==================================================
' 參數(shù)設(shè)置開始
smtpserver = "smtp.163.com" '發(fā)送郵件所使用的SMTP服務(wù)器,例如smtp.163.com
smtpuser = XX '與SMTP服務(wù)器對應(yīng)的郵箱用戶名
smtppwd = "xx" '與SMTP服務(wù)器對應(yīng)的郵箱密碼
smtpemail = "XX@163.com" 'SMTP服務(wù)器發(fā)信郵箱
myemail=trim(Request("email")) '用來接收郵件的郵箱,可以與SMTP服務(wù)器發(fā)信郵箱不同
mail=Request("smtpemail")
' 參數(shù)設(shè)置結(jié)束
'==================================================
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>的訂單內(nèi)容如下:<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; '>提交訂單功,我們將及時與您取得聯(lián)系,如有任何問題請撥打我們服務(wù)熱線!<br>此訂單已經(jīng)生效,不需要多次提交,謝謝!<a href=javascript:history.go(-1)>返回上一頁</a></div>"
else
msg = "發(fā)送失敗,配置是否正確.<a href=javascript:history.go(-1)>返回上一頁</a>"
end if
jmail.Close
set jmail = nothing
end if
end if
%>