I want to save emails if it is bounced while sending email through PHP function mail() ? What is best way to catch that ?
How to catch bounced emails in PHP?
12.4k Views Asked by Naveed Metlo At
2
I want to save emails if it is bounced while sending email through PHP function mail() ? What is best way to catch that ?
First you need to send email with mail() function with the use of additional headers. You point the return email address to a mailbox where you will gather the bounced emails. The below code is an example how to achieve that.
SOURCE
Than you just check the inbox for bounced error emails. The below example code will connect to an imap inbox, fetch and print out all the emails it finds there. You can easily customise it to your needs.
SOURCE