如果您在自己的机器上试,请下载Jmail.dll,下载解压后,双击Setup.bat 即可完成安装!
<%
On error resume next
Dim JMail, contentId
Set JMail = Server.CreateObject("JMail.Message")
JMail.Charset = "gb2312" ' 邮件字符集,默认为"US-ASCII"
' JMail.ISOEncodeHeaders = False ' 是否进行ISO编码,默认为True
' 发送者信息(可用变量方式赋值)
JMail.From = "someone@51windows.net" ' 发送者地址
JMail.FromName = "wangw" ' 发送者姓名
JMail.Subject = "邮件主题" ' 邮件主题
' 身份验证
JMail.MailServerUserName = "myusername" ' 身份验证的用户名
JMail.MailServerPassword = "mypassword" ' 身份验证的密码
' 设置优先级,范围从1到5,越大的优先级越高,3为普通
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
' 加入一个收件人【变量email:收件人地址】可以同一语句重复加入多个
JMail.AddRecipient("someone@somehost.com")
' 加入附件【变量filename:附件文件的绝对地址,确保用户IUSR_机器名有访问的权限】
' 【参数设置是(True)否(False)为Inline方式】
'contentId = JMail.AddAttachment (Server.MapPath("jmail.asp"), True)
' 邮件主体(HTML(注意信件内链接附件的方式))
JMail.HTMLBody = "<html><head><META content=zh-cn http-equiv=Content-Language><meta http-equiv=""Content-Type"" content=""text/htmlcharset=gb2312""><style type=text/css>A:link { FONT-SIZE: 9ptTEXT-DECORATION: nonecolor: #000000}A:visited {FONT-SIZE: 9ptTEXT-DECORATION: nonecolor: #666666}A:hover {COLOR: #ff6600FONT-SIZE: 9ptTEXT-DECORATION: underline}BODY {FONT-SIZE: 9pt} --></style></head><body><font color=red>邮件正文</font><br><font color=green>邮件正文</font><br><b>邮件正文</b></body></html>"
' 邮件主体(文本部分)
JMail.Body = "我们的邮件采用了HTML格式,但是您的邮件查看软件可能不支持。。。邮件正文,邮件正文,邮件正文"
' 发送【调用格式:objJMail.Send([username:password@]SMTPServerAddress[:Port])】
JMail.Send("smtp.163.com")
' 关闭并清除对象
JMail.Close()
Set JMail = Nothing
if err.number<>0 then
response.write "发送发送失败!"
else
response.write "邮件发送成功!"
end if
%>
JMail发送需要发送邮箱帐号密码~~~~~换下面这段试试看吧`~~
当然把帐号密码填上,还有确保你的Mail服务器能够发送`~~
on error resume next
dim JMail
Set JMail = Server.CreateObject("JMail.Message")
'JMail.silent = true
JMail.Logging = True
JMail.Charset = "gb2312"
JMail.ContentType = "text/html"
JMail.From = "chenshouhu@tea600.com"
JMail.FromName = "发信人"
JMail.MailServerUserName = "邮箱帐号"
JMail.MailServerPassword = "邮箱密码"
JMail.Priority = 1
JMail.AddRecipient "pengpeng-410@163.com"
JMail.Subject = "html格式的邮件"
JMail.Body = "你好,谢谢你访问我们的网站" &yourHost
'JMail.AddHeader "Originating-IP", GBL_IPAddress
JMail.Send("mail.tea600.com")
Set JMail = nothing
If err then Response.write "发送错误"
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)