Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $SMTPServer = "smtp.gmail.com"
- $SMTPPort = "587"
- $Username = "jewishnuggets@gmail.com"
- $Password = "yiashbcejvbsjeil"
- $to = "tomjacksonhyde@gmail.com"
- $subject = "Email Subject"
- $body = "Insert body text here"
- $attachment = "H:\capture.png"
- $message = New-Object System.Net.Mail.MailMessage
- $message.subject = $subject
- $message.body = $body
- $message.to.add($to)
- $message.from = $username
- $message.attachments.add($attachment)
- $smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
- $smtp.EnableSSL = $true
- $smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
- $smtp.send($message)
- write-host "Mail Sent"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement