| Linode Forum https://forum.linode.com/ |
|
| Call PHP script in Postfix https://forum.linode.com/viewtopic.php?f=11&t=5768 |
Page 1 of 1 |
| Author: | swanny [ Thu Jul 01, 2010 6:21 pm ] |
| Post subject: | Call PHP script in Postfix |
Hi All, I've used the following guide http://library.linode.com/email/postfix ... -fedora-13 to setup email on my new Linode and all is working well, on my last host I was able to deliver email to a specific address which could then call a PHP script, I think this was in Qmail before but now I am using Postfic. I've tried adding a rule to the aliases file as detailed here http://jeroensmeets.net/setup-postfix-t ... il-to-php/ however this does not work, I expect because the mail is handled by a virtual users table in MySQL, I also tried adding the rule to the MySQL forwarding table with no success, any ideas? |
|
| Author: | Azathoth [ Fri Jul 02, 2010 2:35 am ] |
| Post subject: | |
Personally, I'd suggest a cron + imap (passive) solution, ie. your script check the email via imap every X seconds or minutes, then acts upon it if new are found. Why? Scales better, you can move to different config/mailserver/cluster with NO code changes (just imap connection params, if even that), plus you have better control over incoming and possibly outgoing messages that way, and such standardized code is then available for future use in different conditions. |
|
| Author: | swanny [ Fri Jul 02, 2010 7:30 pm ] |
| Post subject: | |
Thanks Azathoth, was never too keen on the IMAP/Cron method as the script needed activated immediately although I found a solution on this forum (I should have searched properly before posting) http://www.linode.com/forums/viewtopic.php?p=28034 Basically, I created forward in my database which forwards an email address to a local user account, then setup the aliases file to point the local account to the PHP script, works perfectly. |
|
| Author: | GrunkaLunka [ Fri Jul 02, 2010 8:12 pm ] |
| Post subject: | |
I second the IMAP suggestion, specially if the PHP implementation supports IDLE. You can leave the script running and it will get notification when a new message arrives. To answer you original question, I got mine to work by first adding an alias from the virtual domain to a local user: example@virtualdomain.com -> local_user (no domain on this one), and then adding the local_user to the /etc/aliases file. I should mention I don't use the MySQL backend, just flat files. Hope that makes sense, let me know otherwise. edit: Haha, should remember to refresh before replying. edit2: Heh, and now I realize you figured it out from a reply I had given someone else here. I had forgotten about that. Good times. |
|
| Author: | swanny [ Sat Jul 03, 2010 7:15 am ] |
| Post subject: | |
Haha, nice one, thanks. |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|