Вы находитесь на странице: 1из 1

PwoerShell email

$filename = logfile.txt
$smtpServer = localhost
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = somebody@yourdomain.com
$msg.To.Add( somebody@theirdomain.com )
$msg.Subject = Nightly Log File
$msg.Body = The nightly log file is attached
$msg.Attachments.Add($att)
$smtp.Send($msg)

Вам также может понравиться