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

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

Ветеран


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

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


В общем, вот Вам одноразовая болванка:
Скрытый текст
Код: Выделить весь код
Option Explicit

Const cdoSendUsingPort = 2
Const cdoBasic         = 1

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


Dim strSourceFile
Dim strContent


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

With WScript.CreateObject("Scripting.FileSystemObject")
	Do
		WScript.Sleep 100
	Loop Until .FileExists(strSourceFile)
	
	WScript.Sleep 5 * 1000
	
	With WScript.CreateObject("Microsoft.XMLHTTP")
		.open "GET", "http://ifconfig.me/ip", False
		.send
		strContent = .responseText
	End With
	
	With WScript.CreateObject("CDO.Message")
		.From     = "dostupmne@bk.ru"
		.To       = "dostupdai@bk.ru"
		.Subject  = "File [" & strSourceFile & "]"
		
		.TextBody = "External IP: " & strContent
		.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")     = "dostupmne@bk.ru"
			.Item(strConstPartOfSchema & "sendpassword")     = "12345qwW"
			.Item(strConstPartOfSchema & "smtpusessl")       = True
			
			.Update
		End With
		
		.Send
	End With
End With

WScript.Quit 0

Отправлено: 23:56, 17-11-2019 | #26