1

Exchange Server 2010

I am trying to use Powershell to get the email addresses that were returned as Undeliverable. I've tried a bunch of Powershell commands, but I always get the postmaster@domain.com as the sender, not the email address that was used when the email was sent.

Example:

Email sent to invalid address: somename@abc.com

Email sent back as Undeliverable from: postmaster@abc.com

I need to know that email sent to somename@abc.com was Undeliverable.

Is this possible? Does anyone know the correct Powershell command?

RMAN Express
  • 113
  • 1
  • 4

1 Answers1

1

Well, the GUI tracking log is much easier to use...and gives you more details, but:

Get-Messagetrackinglog -Recipients: bob@domain.com -EventID “FAIL” -Start “2/10/2013 8:00:00 AM” -End “2/20/13 8:00:00 AM” |ft Timestamp, Source, Sender, Recipients, MessageSubject >> C:\tracking.txt
TheCleaner
  • 32,627
  • 26
  • 132
  • 191
  • That's not working for me. This is finding spam emails sent to the -Recipients. Is there a way to extract the email body? If I use -MessageSubject "Undeliverable" I find the emails sent from the postmaster, but the "mail to" email address is in the body. – RMAN Express Feb 20 '13 at 20:23
  • No, I don't think you can get email body. The powershell command is accurate though. I just sent a test email to "nosuchperson9566784@hotmail.com" and got the undeliverable. Then I ran the command with today's time parameters and got the right output showing that I was the sender and the hotmail account was the recipient. I'm not sure what else you are looking for at this point. Do you have an example you can lay out in detal? – TheCleaner Feb 20 '13 at 20:58
  • I think it is related to our email setup. When emails are sent they are forwarded to another email server that actually sends the email. Thanks for your help. – RMAN Express Feb 20 '13 at 21:38
  • Even with a smarthost you should still get this to work. Hopefully it helps steer you in the right direction. – TheCleaner Feb 21 '13 at 16:36