I've been googling all night for postfix howto's, but still I couldn't figure out how do I manage to receive email on linux-server (being more specific - Ubuntu).
All I need is a catch-all mailbox which gets all emails and feeds them to the ruby script (which then passes it to Rails, of course). I was able to set-up postfix for sending emails a while ago and I have to say - it wasn't painful at all, I did almost nothing besides actually installing it.
Could you suggest a good howto, or a recipe, or an alternative easy-to-setup mail-server that could solve the issue?
Choose the account you wish to receive mail that is forwarded to your Ruby script. Edit the .forward
file in the home directory of that script to read
"|/path/to/my/ruby/script"
When postfix delivers mail to the account, it will run the script with the permissions of the designated user and will provide the mail on standard input. Depending on what you do with the mail you may want to authenticate it in some way so that the script knows it is really from you. (E.g., header with salt and SHA1 hash of salt+password.)
Here's a real-life example from my own hairy mail system:
"|/home/nr/bin/filtermail /home/nr/machine/x86-bsd/bin/luapipe /home/nr/machine/x86-bsd/bin/safe-slocal 2>>/home/nr/slocal.log 1>&2"
This goes to a shell script which then calls both Lua and C programs to dispose of mail properly.