1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-18 18:51:12 +01:00

Merge pull request #50 from davidreuss/master

Support for single-reply-handler domain
This commit is contained in:
Evan Priestley 2011-08-22 10:37:17 -07:00
commit 8690c66191
4 changed files with 39 additions and 3 deletions

View file

@ -207,6 +207,16 @@ return array(
// PhabricatorMailReplyHandler (and possibly of ManiphestReplyHandler).
'metamta.maniphest.reply-handler' => 'ManiphestReplyHandler',
// If you don't want phabricator to take up an entire domain
// (or subdomain for that matter), you can use this and set a common
// prefix for mail sent by phabricator. It will make use of the fact that
// a mail-address such as phabricator+D123+1hjk213h@example.com will be
// delivered to the phabricator users mailbox.
// Set this to the left part of the email address and it well get
// prepended to all outgoing mail. If you want to use e.g.
// 'phabricator@example.com' this should be set to 'phabricator'.
'metamta.single-reply-handler-prefix' => null,
// Prefix prepended to mail sent by Maniphest. You can change this to
// distinguish between testing and development installs, for example.
'metamta.maniphest.subject-prefix' => '[Maniphest]',

View file

@ -166,7 +166,16 @@ abstract class PhabricatorMailReplyHandler {
$receiver->getMailKey(),
$receiver->getPHID());
return "{$prefix}{$receiver_id}+public+{$hash}@{$domain}";
$address = "{$prefix}{$receiver_id}+public+{$hash}@{$domain}";
return $this->getSingleReplyHandlerPrefix($address);
}
protected function getSingleReplyHandlerPrefix($address) {
$single_handle_prefix = PhabricatorEnv::getEnvConfig(
'metamta.single-reply-handler-prefix');
return ($single_handle_prefix)
? $single_handle_prefix . '+' . $address
: $address;
}
protected function getDefaultPrivateReplyHandlerEmailAddress(
@ -186,7 +195,8 @@ abstract class PhabricatorMailReplyHandler {
$handle->getPHID());
$domain = $this->getReplyHandlerDomain();
return "{$prefix}{$receiver_id}+{$user_id}+{$hash}@{$domain}";
$address = "{$prefix}{$receiver_id}+{$user_id}+{$hash}@{$domain}";
return $this->getSingleReplyHandlerPrefix($address);
}
}

View file

@ -92,8 +92,16 @@ class PhabricatorMetaMTAReceivedMail extends PhabricatorMetaMTADAO {
// We've already stripped this, so look for an object address which has
// a format like: D291+291+b0a41ca848d66dcc@example.com
$matches = null;
$single_handle_prefix = PhabricatorEnv::getEnvConfig(
'metamta.single-reply-handler-prefix');
$prefixPattern = ($single_handle_prefix)
? preg_quote($single_handle_prefix, '/') . '\+'
: '';
$pattern = "/^{$prefixPattern}((?:D|T)\d+)\+([\w]+)\+([a-f0-9]{16})@/U";
$ok = preg_match(
'/^((?:D|T)\d+)\+([\w]+)\+([a-f0-9]{16})@/U',
$pattern,
$to,
$matches);

View file

@ -43,6 +43,14 @@ configured correctly, according to the instructions below -- will parse incoming
email and allow users to interact with Maniphest tasks and Differential
revisions over email.
If you don't want phabricator to take up an entire domain (or subdomain) you
can configure a general prefix so you can use a single mailbox to receive mail
on. To make use of this set ##metamta.single-reply-handler-prefix## to the
prefix of your choice, and phabricator will prepend this to the 'Reply-To'
mail address. This works because everything up to the first (optional) '+'
character in an email-address is considered the receiver, and everything
after is essentially "ignored".
You can also set up a task creation email address, like ##bugs@example.com##,
which will create a Maniphest task out of any email which is set to it. To do
this, set ##metamta.maniphest.public-create-email## in your configuration. This