I have been trying to make a basic mail client with PHP for quite some time, and I always seem to fail. I have tryed numerous things, but I have found nothing that works, but i'm not giving up.
I have private hosting from a good friend, comes right off a datacenter in Maryland. I of course do not have root access to my hosting, so that's a serious disadvantage. What I want to do is have ALL incoming mail piped to a php script where I can store it in a MySql database. I believe my current server is using SendMail.
I have tryed creating a .forward file to pipe it to a php script, but it never worked, not to mention it only allowed it to work for one email address, when I need it to any address that's directed to my domain.
So, do we have any experts in here that have ever created a system like this? I see them everywhere, I figured it should be possible with PHP.
Pipe ALL incoming emails to PHP script
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Use Exim, write a system filter like this:
Code: Select all
pipe "/usr/bin/php yourscript.php $sender_address $recipients $h_Subject: $message_body $message_id"
finishMuch tidier thoughtsd11wtq wrote:Use Exim, write a system filter like this:
Code: Select all
pipe "/usr/bin/php yourscript.php $sender_address $recipients $h_Subject: $message_body $message_id" finish
-
jamiel
- Forum Contributor
- Posts: 276
- Joined: Wed Feb 22, 2006 5:17 am
- Location: London, United Kingdom
Perhaps you can ask your admin to do it for you.
You need to setup an alias for your user in /etc/aliases (or /etc/mail/aliases)
And as a security precaution most sendmail configurations don't allow you to pipe to untrusted scripts. To make it trusted you need to create a symlink to smrsh
You need to setup an alias for your user in /etc/aliases (or /etc/mail/aliases)
Code: Select all
myuser: "| myscript.php"Code: Select all
ln -s myscript.php /etc/smrsh/myscript.php