I want to improve our mail server lists by handling all the bounces we get in our websites. I have a website which has over 8000+ users and another website which as over 1500+ users, they are emailed various notifications every second, ie. job alerts, email alerts,

I am using POP connections with EXIM on APACHE server, most scripts are based on PHP language generates email on the fly.

Problems i have

  1. But some users has registered long time ago and now quite few has bounce email address
  2. Some users register with dummy emails like ss@ss.com which never existed but a valid email address, any chance of stopping this without asking them login to the email account and clicking links which dont work most times.. (too annoying to the end user)
  3. Server is sending unnecessary emails can be avoided if i know they dont exists ?

Solutions i need to have

  1. Is there a way i can download the bounce email list somewhere (WHM/Cpanel), i know exim mail has it but its not readable (i need a file like CSV or something similar to scan them over and write a php script to delete the users from the database ?)

  2. I need to know if there is any function in the PHP that can check the existence of the email address on the fly ? so that i can set the email send function in the mailer class to check before it sends out.

  3. On the server will bouncing emails are going to eatup lots of server resources ? like memory/cpu on processing them ? or are they are minimal where we dont have to worry about this at all ?

  4. May be a opensoruce or linux software to capture them and view them in a report basis and cleaning them up ?

I am not a linux expert or server admin but i do lot of PHP coding, so please be descriptive of the solutions specially if they are linux commands

Thank you!


Exim managing bounced and failed messages

For better management - have a read at the above post and implement (if Possible) a Mailing List Management solution considering you have around 9000 users to manage !

A quick google search with "php check existence of an email"


Hope that helps


What you're asking for is very complicated and could send spam filters in to overdrive if not properly implemented. To properly answer this I'm going to assume you know the anatomy of an email as described in RFC2822.

Please read section 3.6.2 - Originator Fields and 3.6.7 - Trace Fields. If you want a solution to detect what emails are bouncing the best thing to do would be to redirect the bounce emails so they can be dealt with.

Bounce emails will always be sent when applicable to the address specified in the return-path header. Know that this is also this address that is checked when validating the email against SPF records. This does not (in most cases) need to match the from address however some spam filters will detect it as spam. Therefore in some cases you will also need to specify the sender header to match the return-path and the from address can still be more or less anything. To improve on this solution one could generate a unique ID as the return-path that goes in to a catch all account on a mail server and processed with a simple script. Once a message is received on an address that matches the corresponding email is automatically unsubscribed.

I'll re-emphasise that you should be careful when configuring a solution like this as you could be blacklisted in the blink of an eye if it is not properly implemented and tested.

As for checking the existence of an email before a message is sent, I wouldn't bother. Firstly an embarrassing amount of mail domains are misconfigured and messages sent to a 'verified' address can still bounce. Secondly your MTA already deals with non-existent addresses as it can't send email to an address that doesn't appear to exist. You are effectively doubling the load in this area.


If you want to process incoming email (including bounces) then procmail gives a huge amoun of flexibility (the FROM_DAEMON maro should match all bounces) then it's simply a matter of piping it into a PHP script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.