This script will get all Exchange 2007/2010 Hub Transport and Exchange 2013 Mailbox servers in your organization and collect the logs. From there you can troubleshoot the message delivery.
The $emails array now includes message tracking logs from all Exchange servers which you can use for troubleshooting. See below:
Here we can see the issues delivering email on one of my test servers where it ran out of resources.