Guest User

Untitled

a guest
Jan 16th, 2019
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $mail = @{
  2. from = "hoge@hoge-solutions.com";
  3. to = "hoge@hoge-solutions.com";
  4. smtp_server = "smtp.gmail.com";
  5. smtp_port = 587;
  6. user = "hoge@gmail.com";
  7. password = "xxxxxxxx";
  8. }
  9.  
  10. $password = ConvertTo-SecureString $mail["password"] -AsPlainText -Force
  11. $credential = New-Object System.Management.Automation.PSCredential $mail["user"], $password
  12.  
  13. Send-MailMessage -To $mail["to"] `
  14. -From $mail["from"] `
  15. -SmtpServer $mail["smtp_server"] `
  16. -Credential $credential `
  17. -Port $mail["smtp_port"] `
  18. -Subject "subject" `
  19. -Body ((Get-process) | out-string) `
  20. -Encoding UTF8 `
  21. -UseSsl
Add Comment
Please, Sign In to add comment