Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jul 01, 2010 6:21 pm 
Offline
Newbie

Joined: Thu Jul 01, 2010 5:59 pm
Posts: 3
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?


Top
   
 Post subject:
PostPosted: Fri Jul 02, 2010 2:35 am 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
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.


Top
   
 Post subject:
PostPosted: Fri Jul 02, 2010 7:30 pm 
Offline
Newbie

Joined: Thu Jul 01, 2010 5:59 pm
Posts: 3
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.


Top
   
 Post subject:
PostPosted: Fri Jul 02, 2010 8:12 pm 
Offline
Junior Member

Joined: Mon Nov 21, 2005 4:23 pm
Posts: 46
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.


Top
   
 Post subject:
PostPosted: Sat Jul 03, 2010 7:15 am 
Offline
Newbie

Joined: Thu Jul 01, 2010 5:59 pm
Posts: 3
Haha, nice one, thanks.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group