Оправляем письмо с помощью vbscript
set objEmail = CreateObject("CDO.Message")
myfolder = "D:\FOLDER1\FOLDER2"
objEmail.From = "from@email"
objEmail.To = "user123@mail.cc"
objEmail.Cc = "cc@email"
objEmail.Subject = "SUBJECT"
objEmail.Textbody = "С ув. qwer" & vbCRLF & " qweqwqweqwe"
objEmail.BodyPart.CharSet = "windows-1251"
Set objFSO = CreateObject("Scripting.FileSystemObject")
set WShell = CreateObject("WScript.Shell")
Dim str1
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(myfolder)
Set files = folder.Files
For each folderIdx In files
if InStr(folderIdx.Name,"USR") then
str1 = myfolder & folderIdx.Name
'WScript.Echo(str1)
objEmail.AddAttachment (str1)
end if
Next
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "exch"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update()
objEmail.Send()
set objEmail = CreateObject("CDO.Message")
myfolder = "D:\FOLDER1\FOLDER2"
objEmail.From = "from@email"
objEmail.To = "user123@mail.cc"
objEmail.Cc = "cc@email"
objEmail.Subject = "SUBJECT"
objEmail.Textbody = "С ув. qwer" & vbCRLF & " qweqwqweqwe"
objEmail.BodyPart.CharSet = "windows-1251"
Set objFSO = CreateObject("Scripting.FileSystemObject")
set WShell = CreateObject("WScript.Shell")
Dim str1
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(myfolder)
Set files = folder.Files
For each folderIdx In files
if InStr(folderIdx.Name,"USR") then
str1 = myfolder & folderIdx.Name
'WScript.Echo(str1)
objEmail.AddAttachment (str1)
end if
Next
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "exch"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update()
objEmail.Send()
Комментариев нет:
Отправить комментарий