Skip to content

Instantly share code, notes, and snippets.

@daurrutia
Last active November 7, 2017 16:04
Show Gist options
  • Save daurrutia/d1f162070e1e3c3bca9014a7c1c7782c to your computer and use it in GitHub Desktop.
Save daurrutia/d1f162070e1e3c3bca9014a7c1c7782c to your computer and use it in GitHub Desktop.
PowerShell: Send Mail Message via Outlook
$outlook = New-Object -comObject Outlook.Application
$mail = $outlook.CreateItem(0)
$mail.To = "user@gmail.com;user2@company.com"
$mail.Cc = "user3@gmail.com;user4@company.com"
$mail.Bcc = "user5@gmail.com;user6@company.com"
$mail.Subject = "MY SUBJECT"
$mail.Body = "Dear Mr. Boss,`n`nHere is the report you requested.`n`nPlease let me know if you have any questions.`n`nSincerely,`nMY NAME`nTITLE`nCONTACT INFO`nCONTACT INFO`nCONTACT INFO"
$mail.Attachments.Add("C:\Users\MYPROFILE\Desktop\FILE.PDF")
$mail.save()
$inspector = $mail.GetInspector
$inspector.Display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment