We weren't quite happy with having to set up a mail server on our Phabricator (I am lazy), so solved the problem with fetchmail instead.
I also can't seem to edit Diviner, so I'm posting it here and you're free to amend/edit/discard it!
put this in /etc/fetchmailrc:
set daemon 10 set logfile /var/log/fetchmail.log poll [SERVER] with proto [PROTOCOL] user "[ACCOUNT]" password "[PASSWORD]" is "phabricator" mda "/usr/bin/procmail /etc/procmailrc -d %T"
We decided to go for procmail instead of sendmail as our mda because we "needed" a simple way to accept multiple aliases for bug filing.
If you have sendmail, you can just leave out the mda (iirc) and use the bottom half of your config for sendmail.
Now, you can actually configure sendmail to deliver to Phabricator. In /etc/aliases, add an entry like this:
phabricator: "| /path/to/phabricator/scripts/mail/mail_handler.php <ENV>"
...where <ENV> is the PHABRICATOR_ENV the script should run under. Run sudo newaliases. Now you likely need to symlink this script into /etc/smrsh/:
sudo ln -s /path/to/phabricator/scripts/mail/mail_handler.php /etc/smrsh/
Finally, edit /etc/mail/virtusertable and add an entry like this:
That will forward all mail to @yourdomain.com to the Phabricator processing script. Run sudo /etc/mail/make or similar and then restart sendmail with sudo /etc/init.d/sendmail restart.
If you want to use procmail you put this into your conf /etc/procmailrc instead (Obviously, this is not really the intended usage of procmail, it's supposed to be a per user kind of deal, but as mentioned above, I am lazy):
LOGFILE=/var/log/procmail.log VERBOSE=yes EXITCODE=0 SHELL=/bin/sh :0 fhw * ^To.*(bruce.wayne|gordon|batman)@[DOMAIN] | formail -i "To: phabricator@[DOMAIN]" :0 w | /path/to/phabricator/scripts/mail/mail_handler.php production