如何使用PHP从“Undelivered Mail Returned to Sender”跟踪电子邮件

We have a list of 50,000 emails. Some of them are non-existent but we don't know which ones.

When we send newsletters to that list, some emails are not being delivered (given that some recipients are non-existing), so we get automatic replied emails like this:

Mail Delivery System I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below....

We would like to attach somehow these notification emails to a php script to flag these emails in the database so we don't use them in future since it is a waste of time and resources.

What is the name of the script or technique we are looking for?

I am copying the emails we get below.

Thank you for your help!

Mail Delivery System <MAILER-DAEMON@gproxy1.mail.unifiedlayer.com>
Attachments5:54 AM (6 hours ago)

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<gaviglio.herve@bbox.fr>: host mx.bbox.fr[194.158.98.50] said: 550 5.1.1
    <gaviglio.herve@bbox.fr>: Recipient address rejected: User unknown in local
    recipient table (in reply to RCPT TO command)

Final-Recipient: rfc822; gaviglio.herve@bbox.fr
Original-Recipient: rfc822;gaviglio.herve@bbox.fr
Action: failed
Status: 5.1.1
Remote-MTA: dns; mx.bbox.fr
Diagnostic-Code: smtp; 550 5.1.1 <gaviglio.herve@bbox.fr>: Recipient address
    rejected: User unknown in local recipient table

There is no simple way to deal with bounced emails. You'll likely save yourself a lot of headaches by using a mailing API like those from SendGrid, MailChimp, and Amazon SES.