jmail asp 发送邮件 绝对好用

'sendMail"99669806@qq.com","QQ","aaaa","bb"

'收件人邮箱,发件人姓名,标题,内容

Function sendMail(email,sendname,zhuti,mailbody)

Server.ScriptTimeOut=5000

If Not isInstallObj("JMail.Message") Then exit function

dim jmail : set jmail=Server.CreateObject("JMail.Message")

If jmail is nothing then exit function

set jmail= server.CreateObject ("Jmail.message") '调用Jmail组件

jmail.Silent = true

jmail.Charset = "utf-8"

JMail.ContentType = "text/html"

'调用变量内容

'=================================

'发件人邮箱

jmail.From = smtp_usermail

'发件人姓名

jmail.FromName = sendname

'收件人邮箱

jmail.ReplyTo = email

'邮件标题

jmail.Subject = zhuti

dim aryEmail,i

if Instr(email,",")>0 then

aryEmail = split(email, ",")

for i=0 to UBound(aryEmail)

if aryEmail(i)<>"" then JMail.AddRecipient Trim(aryEmail(i))''收件人郵箱地址,收件人姓名

next

else

'收件人邮箱

jmail.AddRecipient email

End if

'邮件内容

jmail.Body = mailbody

'用户名

jmail.MailServerUserName = smtp_user

'密码

jmail.MailServerPassWord = smtp_password

'发送邮件

sendMail=jmail.Send(smtp_server)

jmail.close : set jmail = nothing

End Function

posted on 2013-01-15 16:00  腾云  阅读(2087)  评论(0编辑  收藏  举报

导航