Question

I am piping all e-mails through a PHP script that checks the To address against a database of valid addresses. If it exists, the rest of the script handles it. However, if it does not exist, how can I bounce the e-mail, the same way the server would if I didn't have the script? Thanks!

Was it helpful?

Solution 2

Turns out this was very easy to solve: Simply echo something in the PHP script (for example, "This account does not exist.") and the mailer daemon generates a bounce-back e-mail with this output included.

OTHER TIPS

The mails are recieved through smtp protocol, in your case also i assume that there is some service running on port 25 which would listen to request for mail from external domains.

There are different ways to bounce the message

->bounce at smtp level itself, as in when u get the recipient list, check f or the id existance and if does-not exists give a 4xx response. The bouncemai l would then be generated by the senders domain automatically.

-> if you have accepted the mail from the domain say gmail.com then u will have to make a new connection to gmail with your bouncemessage, this is same as sending a new mail from your server to gmail.com.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top