asp发送邮件代码(简单实用)

2013 年 4 月 1 日4960

asp发送邮件代码(简单实用)

作者:shnxn网站:凡人网络

<%


E_Server = "mail.1488.com" ''发件服务器


E_ServerUser = "joy@1488.com" ''登录用户名


E_ServerPass = "123456" ''登录密码


E_SendManMail = "joy@1488.com" ''发件人邮件地址


E_SendManName = "系统管理员" ''发件人姓名



Sub Jmail(Email,Topic,Mailbody)


On Error Resume Next


Dim JMail


Set JMail = Server.CreateObject("JMail.Message")


JMail.silent=true


JMail.Logging = True


JMail.Charset = "gb2312"


If Not(E_ServerUser = "" Or E_ServerPass = "") Then


JMail.MailServerUserName = E_ServerUser


JMail.MailServerPassword = E_ServerPass


End If


JMail.ContentType = "text/html"


JMail.Priority = 1


JMail.From = E_SendManMail


JMail.FromName = E_SendManName


JMail.AddRecipient Email


JMail.Subject = Topic


JMail.Body = Mailbody


JMail.Send (E_Server)


Set JMail = Nothing


SendMail = "OK"


If Err Then SendMail = "False"


End Sub



Sub Cdonts(Email,Topic,Mailbody)


On Error Resume Next


Dim ObjCDOMail


Set ObjCDOMail = Server.CreateObject("CDONTS.NewMail")


ObjCDOMail.From = E_SendManMail


ObjCDOMail.To = Email


ObjCDOMail.Subject = Topic


ObjCDOMail.BodyFormat = 0


ObjCDOMail.MailFormat = 0


ObjCDOMail.Body = Mailbody


ObjCDOMail.Send


Set ObjCDOMail = Nothing


SendMail = "OK"


If Err Then SendMail = "False"


End Sub



Sub Aspemail(Email,Topic,Mailbody)


On Error Resume Next


Dim Mailer


Set Mailer = Server.CreateObject("Persits.MailSender")


Mailer.Charset = "gb2312"


Mailer.IsHTML = True


Mailer.username = E_ServerUser


Mailer.password = E_ServerPass


Mailer.Priority = 1


Mailer.Host = E_Server


Mailer.Port = 25


Mailer.From = E_SendManMail


Mailer.FromName = E_SendManName


Mailer.AddAddress Email,Email


Mailer.Subject = Topic


Mailer.Body = Mailbody


Mailer.Send


SendMail = "OK"


If Err Then SendMail = "False"


End Sub


dim SendMail


Sub SendEmail(Mailto,Subject,HtmlCode,SendMode)


if SendMode="" then SendMode="Jmail"


if SendMode="Jmail" then


Jmail MailTo,Subject,HtmlCode


elseif SendMode="Cdonts" then


Cdonts MailTo,Subject,HtmlCode


elseif SendMode="Aspemail" then


Aspemail MailTo,Subject,HtmlCode


end if


End Sub


SendEmail "收件人hjc73@126.com","主题","正文","Jmail"


%>



需要修改的地方:


1.smtp服务器设置


2.最后一行分别修改为:收件人,主题,正文,发送组建



转载请注明出自:凡人网络VenShop.Com

发现内容有误 / 侵犯您的版权

↑相关文章:

0 0