Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


Пробуйте:
Скрытый текст
Код: Выделить весь код
Option Explicit

Const cdoSendUsingPort = 2
Const cdoBasic = 1

Const strConstPartOfSchema = "http://schemas.microsoft.com/cdo/configuration/"


Dim strSourceFile


strSourceFile = "C:\Мои проекты\0135\Sample.txt"

With WScript.CreateObject("Scripting.FileSystemObject")
	If .FileExists(strSourceFile) Then
		With WScript.CreateObject("CDO.Message")
			.From     = "NameFrom@mail.ru"
			.To       = "NameTo@mail.ru"
			.Subject  = "File [" & strSourceFile & "]"
			
			.TextBody = "Мама мыла раму"
			.TextBodyPart.Charset = "windows-1251"
			
			.AddAttachment strSourceFile
			
			With .Configuration.Fields
				.Item(strConstPartOfSchema & "smtpserver")       = "smtp.mail.ru"
				.Item(strConstPartOfSchema & "sendusing")        = cdoSendUsingPort
				.Item(strConstPartOfSchema & "smtpserverport")   = 465
				.Item(strConstPartOfSchema & "smtpauthenticate") = cdoBasic
				.Item(strConstPartOfSchema & "sendusername")     = "NameFrom@mail.ru"
				.Item(strConstPartOfSchema & "sendpassword")     = "***Password here***"
				.Item(strConstPartOfSchema & "smtpusessl")       = True
				
				.Update
			End With
			
			.Send
		End With
	Else
		WScript.Echo "Source file [" & strSourceFile & "] not found."
		WScript.Quit 1
	End If
End With

WScript.Quit 0

Отправлено: 22:04, 16-11-2019 | #6