Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.