'函数名: SendMail
'作 用:用Jmail组件发送邮件
'参 数:
' MailtoAddress -----收信人信箱
' Subject -----主题
' MailBody -----信件内容
' MailFrom -----发信人信箱
' MailServerUser -----登陆邮箱用户名
' MailServerPass -----登陆邮箱密码
' MailServer -----发件SMTP服务器
'**************************************************
Function SendMail(MailtoAddress, Subject, MailBody, MailFrom, MailServerUser, MailServerPass, MailServer)
' on error resume next
Dim JMail As JMail.Message, JMailstat
Set JMail = CreateObject("JMail.Message")
If Err Then
Err.Clear
JMail.Close
Set JMail = Nothing
Exit Function
End If
JMail.Charset = "gb2312" '邮件字符集
JMail.Silent = True '忽略错误
JMail.ContentType = "text/html" '邮件编码
JMail.AddRecipient MailtoAddress '收件人地址
'JMail.ReturnReceipt = True '是否收条(验证中)
JMail.From = MailFrom '发件人邮箱
'JMail.MailDomain = MailDomain '邮箱所在域名(验证中)
'JMail.FromName = FromName '发件人姓名
JMail.MailServerUserName = MailServerUser '邮箱用户名
JMail.MailServerPassWord = MailServerPass '邮箱密码
JMail.Subject = Subject '邮件主题
'JMail.Body = MailBody '邮件正文(纯文本格式)
JMail.HTMLBody = MailBody '邮件正文(HTML格式)
'JMail.Priority = 3 '邮件等级,1为加急,3为普通,5为低级
JMailstat = JMail.Send(MailServer)
If JMailstat Then
SendMail = True
Else
'MsgBox JMail.Log
SendMail = False
End If
JMail.Close
Set JMail = Nothing
End Function
VB6, ASP 通用的 用Jmail组件发送邮件
最新推荐文章于 2018-09-03 11:08:17 发布