邮件发组函数,经典收藏。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值