$username = 'donotreply@domain.com'
$password = 'XXXXXXXXX'
$body = Get-Content -Path C:\Users\Location.txt -Raw
[SecureString]$securepassword = $password | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $securepassword
Send-MailMessage -SmtpServer 2XX.XXX.xx.xx -Port 587 -From donotreply@domain.com -To email@domain.com -Cc email1@domain.com,email2@domain.com -Subject 'EMAIL SUBJECT' -Body $body -Credential $credential -Attachments "C:\Users\locationfile.txt";
No comments:
Post a Comment