I used to pipe incoming emails using:

|/path/to/php/script in .forward file at /home folder.

But the actual system I'm working on is based on Maìldir instead MBOX. So that solution does not work.

I have no clue how to pipe emails correctly to PHP.

migrated from stackoverflow.com Mar 3 '11 at 5:12

This question came from our site for professional and enthusiast programmers.

  • there is a mail server called "Maìldir" ? got a link? – Dagon Mar 2 '11 at 20:02
  • maildir is a format for storing email server-side, usually used by IMAP servers. – Marc B Mar 2 '11 at 20:08
  • ah, that explains it. – Dagon Mar 2 '11 at 20:47

It should be similar, what are you trying to accomplish? My server is in Maildir format, and I have something similar to what you are doing and it works fine. It shouldn't matter if you're using Maildir or MBOX format, all that is handled by the mail server.

  • Thanks, luckytaxi. The email box at maildir is different from my linux username. So when I put a .forward file at Home, nothing happens. I can list all my emails at /home/username/mail, but they are stuck there. I can't forward to anywhere. – Andre Resende Mar 2 '11 at 20:21
  • So are you trying to forward an email or do something else with it using PHp? – luckytaxi Mar 2 '11 at 20:29
  • Yes. I followed the tutorial at evolt.org/incoming_mail_and_php using Exim configurations (my MTA is Exim). But it just works if linux-username is email username. – Andre Resende Mar 2 '11 at 20:34
  • Ohhh i see now, that's the same tutorial I tried. Do what grawity said, put it inside /etc/aliases. That way, an email comes in and your MTA immediately knows what to do with it. – luckytaxi Mar 2 '11 at 21:46

|/path/to/script should work just fine. Forwarding, whether using ~/.forward or procmail, is done before the mail system gets to touch your Maildirs.

In case of "virtual mailboxes", /etc/aliases can do the same thing.

foouser: |/path/to/script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy