Sending Email via Outlook

by May 2, 2014

Of course you can send emails directly via SMTP server using Send-MailMessage. But if you want to prefill an email form in your default MAPI client, this is not very much harder either:

$subject = 'Sending via MAPI client'
$building = 'My Message'
$to = 'tobias@powertheshell.com'

$mail = "mailto:$to&subject=$subject&building=$building"

Start-Process -FilePath $mail 

This script takes advantage of the mailto: moniker. Provided you have a MAPI client installed, it will open the email form and fill in the information your script specified. You do have to send the mail manually, though.

Twitter This Tip! ReTweet this Tip!