用ASP发送邮件

80酷酷网    80kuku.com

  可以通过Jmail组件发送邮件.首先要在WEB服务器安装JMAIL组件.下面是一个对象实例,可以通过call SendMail (receive)的方法来调用发送邮件

可以通过Jmail组件发送邮件.
首先要在WEB服务器安装JMAIL组件.
下面是一个对象实例,可以通过call SendMail (receive)的方法来调用发送邮件
<%
Sub SendMail(receive)
On Error Resume Next
Set jmail = Server.CreateObject("JMAIL.Message")
jmail.silent = false '屏蔽例外错误,返回FALSE跟TRUE两值
jmail.logging = true '启用邮件日志
jmail.Charset = "gb2312" '
jmail.AddRecipient receive '邮件收件人的地址
jmail.From = "adminXXX.com.cn" '发件人的E-MAIL地址
jmail.FromName = "主题" '发件人名
jmail.MailServerUserName = "admin" '邮箱用户名
jmail.MailServerPassword = "xxx" '邮箱密码
jmail.Subject = "Message" '邮件主题
jmail.Body = "body" '邮件内容
jmail.Priority = 3 '邮件的紧急程序,1 为最快,5 为最慢, 3 为默认值
mailserver="smtp.xxx.net" '发件服务器
jmail.Send(mailserver) '执行邮件发送(通过邮件服务器地址)
If Err.Number<>0 then
        sendMsg="发送失败!"
    Else
        sendMsg="已发送!"
    End If
    Response.Write(sendMsg)
jmail.Close()
set jmail=nothing
end sub
%>
jmail 组件可以网上下载

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: