卖咖啡的牛逼哄哄……
本帖最后由 lyscser 于 2011-1-30 20:36 编辑这段简单的代码,卖咖啡居然把它当病毒杀?没听说mcafee有这么SB兼NB啊……害得老子source文件丢失……大面积运行失败
Function SendMail(mailFrom,mailSmtp,sendUserName,sendUserPassword,mailTo,mailSubject,mailBody,mailAttachment)
Const conSendUsing ="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const conServer ="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const conServerPort ="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const conConnectionTimeout ="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const conAuthenticate ="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const conUsessl ="http://schemas.microsoft.com/cdo/configuration/smtpusessl"
Const conSendUserName ="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const conSendPassword ="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Set objMessage = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
Set objMessage.Configuration = objConfig
With Fields
.Item(conSendUsing) = 2 '2为使用外部SMTP服务器,不要更改
.Item(conServer) = mailSmtp '改成可用的外部邮件服务器域名
.Item(conServerPort) = 25 '外部SMTP服务器端口,gmail使用465,其它一般使用25
.Item(conConnectionTimeout) = 20 '设定连接超时,单位秒
.Item(conUsessl) = False '是否使用SSL安全套接字,gmail为true,其它一般false
.Item(conAuthenticate) = 1 '1为发送邮件需要认证,通常不要更改
.Item(conSendUserName) = sendUserName
.Item(conSendPassword) = sendUserPassword
.Update
End With
With objMessage
.To = Trim(mailTo) '改成接收者的邮件地址
.From = mailFrom '改成发送人的邮件地址,要和上面的邮件系统相同
.Subject = Trim(mailSubject) '标题
.HTMLBody ="<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=Shift_JIS"" /></head>"&_
"<body>"&mailBody&"</body></html>" 'HTML邮件正文
.BodyPart.Charset = "Shift_JIS" '邮件编码
.HTMLBodyPart.Charset="Shift_JIS" '邮件HTML格式编码
IfTrim(mailAttachment) <> "" Then
.AddAttachmentmailAttachment '邮件附件
End If
.Send
End With
Set objMessage = Nothing
Set objConfig = Nothing
End Function http://www.jb51.net/article/473.htm
试试这里的解决方法吧 多谢,貌似没有找到对应的原因,可能是创建对象时的问题吧
Set objMessage = CreateObject("CDO.Message")
Set objConfig = CreateObject("CDO.Configuration") 主动防御认为往外发email也是属于hack行为吧
页:
[1]