$EmailFrom = "xx@gmail.com"
$EmailTo = "yy.com"
$Subject = "Testing, Testing 123"
$Body = "this is a notification from XYZ Notifications.."
$Attachment = "C:\Users\XX\Desktop\Importanttxts\old.txt"
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.CredentialsObjectSystem.Net.NetworkCredential("pm8566","123456");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body, $Attachment)
cmd /c pause | out-null
Это мой сценарий powershell, он отлично работает, но без вложений не может отправить вложение.