邮件发组函数,经典收藏。
2004-09-04 16:30
1001 查看
Function SendMail(comp, mailserv, fromname, fromemail, toname, toemail, subject, body)
Dim myMail
On Error Resume Next
Select Case comp
Case 1 'ASPMail
Set myMail = Server.CreateObject("SMTPsvg.Mailer")
myMail.FromName = fromname
myMail.FromAddress = fromemail
myMail.ContentType = strcontent
myMail.Priority = strpriority
myMail.ReturnReceipt= strreceipt
myMail.RemoteHost = mailserv
myMail.AddRecipient toname, toemail
myMail.Subject = subject
myMail.BodyText = body
myMail.SendMail
Case 2 'ASPEmail
Set myMail = CreateObject("Persits.MailSender")
myMail.From = fromemail
myMail.FromName = fromname
myMail.IsHTML = strcontent
myMail.Priority = strpriority
myMail.Host = mailserv
myMail.AddAddress toemail
myMail.Subject = subject
myMail.Body = body
myMail.Send
Case 3 'CDONTS
Set myMail = server.CreateObject("CDONTS.NewMail")
myMail.To = toemail
myMail.Value("Reply-To") = fromemail
myMail.From = fromemail
myMail.Subject = subject
myMail.MailFormat = strcontent
myMail.BodyFormat = strcontent
myMail.Importance = strpriority
myMail.Body = body
myMail.Send
Case 4 ' Dynu Email
Set myMail = Server.CreateObject("Dynu.Email")
myMail.isHTML = True
myMail.Smtp = mailserv
result = myMail.Send(fromemail, toemail, subject, body)
Case 5 'W3 JMail 4.1
set myMail = Server.CreateOBject( "JMail.Message" )
myMail.Logging = true
myMail.silent = true
myMail.From = fromemail
myMail.FromName = fromname
myMail.AddRecipient toemail, toname
myMail.Subject = subject
myMail.Body = body
SendMail = myMail.Send(mailserv)
Case 6 'W3 JMail 4.1 HTML
Set myMail = Server.CreateObject("JMail.Message")
myMail.AddRecipient toemail, toname
myMail.From = fromemail
myMail.Body = "Sorry, you cannot read HTML."
myMail.Subject = subject
myMail.HTMLBody = body
SendMail = myMail.Send(mailserv)
Case 7 'Simple Mail
Set myMail = Server.CreateObject("ADISCON.SimpleMail.1")
myMail.MailServer = mailserv
myMail.Sender = fromemail
myMail.Recipient = toemail
myMail.Subject = subject
myMail.MessageText = body
call myMail.Send
Case 8 'OCXMail
set myMail = Server.CreateObject("ASPMail.ASPMailCtrl.1")
result = myMail.SendMail(mailserv, toemail, fromemail, subject, body)
Case 9 'VSMail 1.x
Set myMail = CreateObject("VSEmail.SMTPSendMail")
myMail.Host = mailserv
myMail.From = fromname & " < " & fromemail & " >"
myMail.SendTo = toemail
myMail.Subject = subject
myMail.Body = body
myMail.Connect
myMail.Send
End Select
Set myMail = Nothing
If Err Then
SendMail = False
Else
SendMail = True
End If
End Function
Dim myMail
On Error Resume Next
Select Case comp
Case 1 'ASPMail
Set myMail = Server.CreateObject("SMTPsvg.Mailer")
myMail.FromName = fromname
myMail.FromAddress = fromemail
myMail.ContentType = strcontent
myMail.Priority = strpriority
myMail.ReturnReceipt= strreceipt
myMail.RemoteHost = mailserv
myMail.AddRecipient toname, toemail
myMail.Subject = subject
myMail.BodyText = body
myMail.SendMail
Case 2 'ASPEmail
Set myMail = CreateObject("Persits.MailSender")
myMail.From = fromemail
myMail.FromName = fromname
myMail.IsHTML = strcontent
myMail.Priority = strpriority
myMail.Host = mailserv
myMail.AddAddress toemail
myMail.Subject = subject
myMail.Body = body
myMail.Send
Case 3 'CDONTS
Set myMail = server.CreateObject("CDONTS.NewMail")
myMail.To = toemail
myMail.Value("Reply-To") = fromemail
myMail.From = fromemail
myMail.Subject = subject
myMail.MailFormat = strcontent
myMail.BodyFormat = strcontent
myMail.Importance = strpriority
myMail.Body = body
myMail.Send
Case 4 ' Dynu Email
Set myMail = Server.CreateObject("Dynu.Email")
myMail.isHTML = True
myMail.Smtp = mailserv
result = myMail.Send(fromemail, toemail, subject, body)
Case 5 'W3 JMail 4.1
set myMail = Server.CreateOBject( "JMail.Message" )
myMail.Logging = true
myMail.silent = true
myMail.From = fromemail
myMail.FromName = fromname
myMail.AddRecipient toemail, toname
myMail.Subject = subject
myMail.Body = body
SendMail = myMail.Send(mailserv)
Case 6 'W3 JMail 4.1 HTML
Set myMail = Server.CreateObject("JMail.Message")
myMail.AddRecipient toemail, toname
myMail.From = fromemail
myMail.Body = "Sorry, you cannot read HTML."
myMail.Subject = subject
myMail.HTMLBody = body
SendMail = myMail.Send(mailserv)
Case 7 'Simple Mail
Set myMail = Server.CreateObject("ADISCON.SimpleMail.1")
myMail.MailServer = mailserv
myMail.Sender = fromemail
myMail.Recipient = toemail
myMail.Subject = subject
myMail.MessageText = body
call myMail.Send
Case 8 'OCXMail
set myMail = Server.CreateObject("ASPMail.ASPMailCtrl.1")
result = myMail.SendMail(mailserv, toemail, fromemail, subject, body)
Case 9 'VSMail 1.x
Set myMail = CreateObject("VSEmail.SMTPSendMail")
myMail.Host = mailserv
myMail.From = fromname & " < " & fromemail & " >"
myMail.SendTo = toemail
myMail.Subject = subject
myMail.Body = body
myMail.Connect
myMail.Send
End Select
Set myMail = Nothing
If Err Then
SendMail = False
Else
SendMail = True
End If
End Function
相关文章推荐
- PHP常用的文件操作函数经典收藏
- JavaMail解析邮件内容(经典收藏)
- PHP数学运算函数大汇总(经典值得收藏)
- phpcms 经典函数收藏
- PHP常用的文件操作函数经典收藏
- JavaScript收藏的经典函数
- PHP数学运算函数大汇总(经典值得收藏)
- [转]关于VIPT cache alias 的一封经典邮件
- DOS命令大全(经典收藏)
- java,Android:在eclipse中的快捷键(经典收藏)
- .NET程序开发中必须收藏的七个类型的经典工具
- 从静态成员函数访问类成员(收藏)
- php图像处理函数大全(推荐收藏)
- [收藏]Mysql日期和时间函数
- 经典收藏:网络命令行的使用和范例(十二)
- .NET经典代码收藏
- linux下模拟控制台经典函数
- 收藏PHP常用函数
- 收藏 不显示删除回复显示所有回复显示星级回复显示得分回复 经典的60句话,慢慢体会 ^_^[
- 调用发送邮件 Monxin专用(PHP代码函数)