how to automatically handle errors emails (unknown recipient) via postfix / linux server

299 Views Asked by At

I need to automatically manage emails not delivered by postfix if the email address is invalid. I use phpmailer to send emails, postfix runs on my debian server, and I would like to be able to store invalid emails to clean my different databases.

I do not quite see how to approach the thing, emailing tools type Eloqua, Mailchimp etc handle hardbounceback, but concretely how? The only way I have found and that looks the most reliable is the addition of Reply-To: Return-Path: in the header of the email to receive an email from the SMTP server when the email is unknown? You confirm me? But if that is the case ? We must send the email to a php script as in the example ? How to handle bounce email with postfix and php?

But if so, the return emails are never the same, what to search and parse in these emails that could correspond to an error, the headers have no standard return ? If anyone has an idea or a track, thanks in advance! :)

1

There are 1 best solutions below

4
KIKO Software On

You can get an email bounce even when an email adres is valid. Think of "mailbox full" messages. I found this link with which you can contact the SMTP server and ask it if the email adress exsist:

https://www.codexworld.com/verify-email-address-check-if-real-exists-domain-php/