【发布时间】:2017-03-24 18:00:59
【问题描述】:
我是 vbs 脚本的新手,但在这段代码中我无法发送附件。它发送电子邮件但没有附件 谁能帮忙
DIM fso
Set fso=CreateObject("Scripting.FilesystemObject")
On Error Resume Next
fso.CopyFile "C:\ASoft32\*.*", "E:\ASoft32\"
'Wscript.Echo "File copy complete."
strSMTPFrom = "jbmotors@hotmail.com"
strSMTPTo = "iain@252.co.uk"
strSMTPRelay = "smtp.live.com"
strTextBody = "Backup done vbs"
strSubject = "VBS ALERT"
strAddAttachment "(C:\ASoft32\Hamer.ftm)"
Set oMessage = CreateObject("CDO.Message")
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPRelay
oMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMessage.Configuration.Fields.Update
oMessage.Subject = strSubject
oMessage.From = strSMTPFrom
oMessage.To = strSMTPTo
oMessage.TextBody = strTextBody
oMessage.AddAttachment strADDAttachment
oMessage.Send
'Wscript.Echo "Email sent."
Const TIMEOUT = 2
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Popup "Email sent" , TIMEOUT
【问题讨论】: