Link to home
Start Free TrialLog in
Avatar of nickstallman
nickstallman

asked on

I need a script which will forward e-mails using a mysql database

I need a script (preferably PHP or Perl) which can check a POP3 box, get the e-mails and forward them depending on the TO to a address stored in a MySQL database which matches the TO.

If that doesnt exist then a way to do it using a mail server (dont care which one) will do.
Avatar of udayms
udayms

Hi,
Can you explain the purpose of the whole excersise. Maybe there are easier ways to achieve your end result than all these.

-Uday
Avatar of nickstallman

ASKER

Ok. Basically I have a list of usernames and e-mail addresses in a MySQL database and I have a wildcard forward to a pop3 address.

I need a script which can forward username@mydomain the e-mail address associated with the username.
Ok.. Nick... I am assuming that you are using a thirdparty webspace provider's service. In that case you wouldnt be able to install any Mail management software on the server. The other option is to have a program that does this task. Try out this link... You might find some useful info there in.
http://www.hotscripts.com/Detailed/35656.html

Or you can take 2 php scripts - 1 that picks  out email ids and contents from the inbox and another that sends  mails from MYSQL DB and then combine them. This miight be a bit time consuming. Besides, in these choices the biggest problem we will have is that someone will have to manually trigger the page/program for it to work. So basically somebody will have to run the process at the end of the day so that all the mails are routed to their respective mail boxes.
Thanks for that one. It'll be useful if I need to make the script myself.

I have a Windows dedi in my house so I can have a mail server running.

Running the program every few miniutes isnt a problem. A Cron job or a scheduled task will do it easily.
I have found my solution:
http://www.gentoo.org/doc/en/virt-mail-howto.xml

Its not a script like I wanted but it'll do the job.
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial