如何在表单提交的时候向指定的邮箱发送邮件
如何在表单提交的时候向指定的邮箱发送邮件?请大家给帮帮我,给我一个详细的步骤。先谢谢大家。
------解决方案--------------------你是用什么组件的?
Jmail ?
------解决方案--------------------sendmail.asp
<%@LANGUAGE= "VBSCRIPT " CODEPAGE= "936 "%>
<%
Function sendMail(mailForm, mailFormName, mailTo, mailSubject, mailContent)
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject( "JMail.Message ")
JMail.Charset = "gb2312 "
JMail.From = mailForm
JMail.FromName = mailFormName
JMail.Subject = mailSubject
JMail.MailServerUserName = "邮件帐号 "
JMail.MailServerPassword = "邮件密码 "
JMail.Priority = 1
JMail.AddHeader "Originating-IP ", Request.ServerVariables( "REMOTE_ADDR ")
JMail.AddRecipient mailTo
JMail.HTMLBody = mailContent
JMail.Send( "SMTP地址 ")
JMail.Close()
Set JMail = Nothing
End Function
%>
表单提交页send.asp
<form name= "form1 " method= "post " action= "Save.asp " onSubmit= "return CheckAdd(this) ">
<input name= "UserName " type= "text " id= "UserName " size= "30 " maxlength= "20 ">
<input name= "Email " type= "text " id= "Email " size= "30 " maxlength= "50 ">
<input name= "Submit " type= "submit " class= "button01-out " value= "确 定 ">
信息处理页save.asp
<!--#include file= "sendmail.asp " -->
<%
acemail=request.Form( "email ")
receivecard=request.Form( "UserName ")
mailForm = "邮件帐号 "
mailFormName = "系统管理员 "
mailSubject = receivecard & ",您好, "&sender& "已收到你的注册信息! "
emailTo = acemail
mailContent = " <p align=left> 亲爱的 "&receivecard& ": </p> <p align=center> "&sender & "[ "&sendemail& "]已收到你的注册信息,如果你是申请正式会员,我们会在审核后通知你是否成为正式会员 "
call sendMail(mailForm, mailFormName, emailTo, mailSubject, mailContent)
Response write "用户注册成功!系统将会发邮件给你确认你的注册信息 "
%>
大概就是这个意思.
------解决方案--------------------我也是在CSDN上请教得出的方法,反正在我自己的服务器上调试通过.需要注意的是在使用企业邮局帐号的时候要增加一个项
JMail.MailDomain= "SMTP邮件服务器地址 "
因为好多企业邮局设置了SMTP需要验证.
我曾经碰到过用万网的企业邮局始终不能发信的情况,后来万网的人给我回邮件说明了要增加这一个项,结果就OK了.
------解决方案--------------------我这个是注册时往注册的邮箱发送欢迎信,你看着改吧.