In my database I store emails like the following: 1. -> 2. -> 3. -> 4. ... 5. ... Now, when someone emails to , how can I have a script or something running somewhere on the server, that intercepts the email, reads from the database and realise that the email is actually for the actual email address which is , and forwards there. How can I do something like this? Any clue?
Why use a database? PHP parsing incoming mail is a PITA - too many things it relies on (Apache as CGI etc.). If you use Postfix, just map it in the virtual file. /etc/postfix/virtual That sort of task is for the MTA, not for PHP.
TOPS30, The PITA site is pretty interesting, perhaps it has something that I can use... I will read it shortly. I need the database, because the email address (xx@mydomain.com) are randomly generated when user registers on my site. Thanks.
Just let PHP write to the MTA mapping file and execute the postmap command upon every registration. Routing email through PHP is like taking the scenic route risking getting lost.
I am a little lost, what is the syntax of the MTA mapping file and where can I locate it? I know that my server is using sendmail.
I only know it for Postfix but sendmail is bound to have something similar. Consult their documentation to look for Postfix' equivalent of the 'virtual' file which does email mapping/redirecting.