Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from 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.

share|improve this answer
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 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
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.