<% sub SendEmail(toemail,fromemail,sender,subject,mess) on error resume next Set JMail = Server.CreateObject("JMail.SMTPMail") JMail.Charset = "gb2312" JMail.ServerAddress ="" JMail.Priority = 2 '高优先级 JMail.contenttype ="text/html" '格式 默认为text/txt JMail.Sender =fromemail '指定发件人的邮件地址 JMail.Subject =subject ' 邮件标题 JMail.SenderName = sender '指定发件人的姓名 JMail.ReplyTo = fromemail '可选的回信地址 JMail.AddRecipient( toemail ) '收件人 JMail.Body = mess if err then '判断是否错误 err.clear end if JMail.Execute() JMail.Close() set jMail=nothing 'response.End end sub '验证防注函数 function validate(str) str=replace(str,"'","''") validate=str end function if request("save")<>"" then dim name,time,address,tel,email,chargecontent '接收并验证表单数据 name=trim(validate(request.Form ("name"))) time=trim(validate(request.Form ("time"))) address=trim(validate(request.Form ("address"))) tel=trim(validate(request.Form ("tel"))) email=trim(validate(request.Form ("email"))) chargecontent=trim(validate(request.Form ("chargecontent"))) '验证必填内容和字符长度 Errmess="" if chargecontent="" then Errmess=Errmess&"请输入您的订购需求!\n" end if if name="" then Errmess=Errmess&"请输入您的姓名!\n" end if if time="" then Errmess=Errmess&"请输入您的单位!\n" end if if tel="" then Errmess=Errmess&"请输入您的联系方式!\n" end if if email="" then Errmess=Errmess&"请输入您的邮箱 \n " end if if len(name)>5 then Errmess=Errmess&"您的姓名长度不能大于5\n" end if if len(address)>100 then Errmess=Errmess&"您的地址长度不能大于100 \n" end if if len(tel)>50 then Errmess=Errmess&"您的电话长度不能大于50 \n " end if if len(email)>100 then Errmess=Errmess&"您的邮箱长度不能大于100\n " end if '向管理员邮件箱发e-mail if Errmess<>"" then response.Write "" response.End else dim mailto,mailsubject,mailbody mailto="huilan_gong@betterren.com" mailsubject="用户注册" bodytext="" bodytext= bodytext & "尊敬的管理员["&Manager&"]:" & "
" bodytext= bodytext & "
" bodytext=bodytext &" 您好!您的网站("&request.ServerVariables("server_name")&"),有用户提交订单。
" bodytext=bodytext &" 用户姓名:"&name&"
单位名称:"&time&"
电话:"&tel&"
地址:"&address&"
E-mail:" &email&"
" bodytext=bodytext &" 订购需求:"&chargecontent&"
" bodytext=bodytext &"
" bodytext=bodytext &" " mailbody=bodytext call SendEmail(mailto,email,name,mailsubject,mailbody) response.Write "" response.End() end if end if %> 我要订购

商务合作

*您的称呼:
*您的单位:
*您的地址:
*您的电话:
*您的邮箱:
*订购需求: