

Set this to a php file that you will be creating, I would recommend putting this outside of your public directory. The option is available under advanced in the default email address settings. It's specifically used by mail daemons to report bounces.įinally, you need to be able to pipe all unrouted emails to a php script, which in turn logs the bounce. Note: This header is different to the "from" and "reply-to" addresses and is usually hidden in mail clients. If, like me, you're using PHPMailer, setting this header is available by using $mail->Sender. eg The mail daemon of the server you're sending to will then send it's bounce message to that address. Second, you need to be able to identify an email when it has bounced, this is accomplished by setting the "Sender" header for the email to a unique identifier. When sending an email, log a unique id, the email address and a timestamp into a database at the very least. This needs to be in place for various other reasons, but it is a requirement to be able to detect and mark an email as bounced. But the core information here can be used on any setup.įirst and foremost, it may seem obvious, but every email needs to be logged by the system. I used PHPMailer on a linux server using cPanel, so most of these instructions are based on this setup. The majority of this was trivial, except for detecting bounces, as I had not dealt with this before. When working on an automated email system for a client, the core requirement was to send mass emails and detect bounces, opens, clicks and unsubscribes for reporting.
