Configuring Postfix for Inbound Email - Phabricator

Local MTA: Configuring Postfix for Inbound Email – Phabricator

Whenever something is update on a software development platform, usually an email is sent to all subscribed users. Phabricator let you reply to those emails and perform a specific action like assign, claim, close, change priority and status, unsubscribe, etc. In order for this to function with a local MTA like Postfix, a manual setup must be done.


Before everything, read the official page on configuring inbound email to see how things work and what configuration must be made. I’ll go again through some setup already mentioned in the guide, just to mention the most important steps and some additional ones.


Configuring Phabricator

Navigate to Mail Configuration page and check if the following options are set:

metamta.single-reply-handler-prefix: post

The metamta.single-reply-handler-prefix option is not mandatory, but this is what I have chosen for my setup because I have other email accounts on For more about this, check the link above.


Local MTA: Installing Mailparse

Install mailparse package as described in the guide (I managed to do it via pecl).

If you have individual files in /etc/php.d/, then search for a mbstring file (I had a 20-mbstring.ini file). All the configs in this directory are loaded alphabetically, so in order to have this package loaded after the mbstring, create a file with a name that will sort higher. For my setup, I’ve created a 21-mailparse.ini file and added the following content to it:

; Enable mailparse extension module


Local MTA: Configuring Postfix

Located at /home/dummy/ the mail_handler.php script must be run by Postfix with a user that has permissions over it.

By default, Postfix runs everything with its own user, therefore if we add the user & script in the /etc/aliases (as described in the guide – Configuring Sendmail section) an error with occur when Postfix will try to run the mail_handler.php script, so we’re going to make some local aliases and then load them in the main configuration of Postfix.


For our we’ll assume that the owner of the  mail_handler.php is dummy.

Now, change directory to /home/dummy/ and run the following:

[dummy@host ~]$ sudo ln -s /home/dummy/ /etc/smrsh/
[dummy@host ~]$ echo "dummy: |/home/dummy/" >> .phabricator_inbound_aliases
[dummy@host ~]$ postalias .phabricator_inbound_aliases

The last two commands will create two files: .phabricator_inbound_aliases and  .phabricator_inbound_aliases.db. Both files must be owned by dummy.


Open /etc/postfix/ in edit mode, search for alias_maps and alias_database and add the domain specific alias after the existing value, separating it via comma. In the end it should look like this:

alias_maps = hash:/etc/aliases, hash:/home/dummy/
alias_database = hash:/etc/aliases, hash:/home/dummy/

After making this change, run sudo newaliases.


Open /etc/postfix/virtual in edit mode and at the end add a new line:     dummy@localhost

This will redirect all email that goes to the specified domain to the dummy alias, which will run the mail_handler.php script that will parse the email and execute given commands.


Restart Apache & Postfix and you’re all set.


  • Remus Avram

    October 19, 2017

    Hi Tanase,
    thanks for sharing this information.
    I am trying to set up inbound email for my Phabricator instance, and I found it (like they say) quite difficult.
    Looking at your post I see that you are not talking anything about configuring MX records. I don’t know how to configure this. Any hints?

    • Tanase Butcaru

      October 20, 2017

      Hi Remus,

      I’m using Webmin/Virtualmin to manage my domains/hosting, so my MX records have been added automatically by the Virtualmin wizard.
      I did nothing special about them, I have the usual MX records a website has.

      If you’re building your server from scratch, without using a control panel (eg. Webmin/VirtualMin, VestaCP, etc), then you have to install & configure your local mail server (sendmail, postfix, etc).

      Tanase B.

  • Remus

    October 19, 2017

    Hi Tanase,
    can you please share with us how you managed to install `mailparse` via `pecl`?
    I failed installing it via `pecl` but I installed `php-pecl-mailparse` rpm package. I am not sure if it’s the same…

    • Tanase Butcaru

      October 20, 2017

      Hi Remus,

      I’ve installed pecl just by following the official guide on how to install mailparse.
      If you don’t have any PHP errors on startup after including, then I think you’re good with php-pecl-mailparse!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.