Reputation: 123
Fairly simple script at the moment I simply need to get the recipients email address out of a msg file, apparently there's not an easy way to parse it in text so I've used the following code, but I only get a name such as 'Joe Smith' when reading the message not [email protected]
Any ideas?
Thanks!
$outlook = New-Object -comobject outlook.application
$msg = $outlook.CreateItemFromTemplate("c:\MyMessage.msg")
$msg | Select to
Upvotes: 0
Views: 2646
Reputation: 66225
You need to access the Recipients collection and read the Recipient.Address property for the items in that collection. You also might want to use Application.Session.OpenSharedItem instead of CreateItemFromTemplate.
Upvotes: 1