Panowie zastanawiam się w jaki sposób napisać skrypt który pokaże nam błąd wysłanej wiadomości ?

coś na styl:
Błąd wysłania emaila

Tytuł maila: Test
Adresat: jakiśtammail@yahoo.com

Błąd: A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

554 delivery error: This user doesn't have a yahoo.com account (jakiśtammail@yahoo.com) [-5] - mta4292.mail.ne1.yahoo.com

---

Błąd: A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

554 5.4.4 Could not resolve remote host - Non-Existent Domain

---

Błąd: A message that you sent could not be delivered to one or more of its recipients.
There have been 8 attempts.
Remaining deliver attempts: 32.

Delivery has been delayed for following recipients:


---

Błąd: A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

550 5.1.1 The email account that you tried to reach does not exist. Please try
5.1.1 double-checking the recipient's email address for typos or
5.1.1 unnecessary spaces. Learn more at
5.1.1 https://support.google.com/mail/?p=NoSuchUser u10-v6si3225085lfc.20 - gsmtp