Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/receiver/PhabricatorMailReceiver.php
| Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | if ($user) { | ||||
| return $user; | return $user; | ||||
| } else { | } else { | ||||
| $reasons[] = pht( | $reasons[] = pht( | ||||
| 'This email was sent from "%s", but that address is not recognized by '. | 'This email was sent from "%s", but that address is not recognized by '. | ||||
| 'Phabricator and does not correspond to any known user account.', | 'Phabricator and does not correspond to any known user account.', | ||||
| $raw_from); | $raw_from); | ||||
| } | } | ||||
| // If we missed on "From", try "Reply-To" if we're configured for it. | |||||
| $raw_reply_to = $mail->getHeader('Reply-To'); | |||||
| if (strlen($raw_reply_to)) { | |||||
| $reply_to_key = 'metamta.insecure-auth-with-reply-to'; | |||||
| $allow_reply_to = PhabricatorEnv::getEnvConfig($reply_to_key); | |||||
| if ($allow_reply_to) { | |||||
| $reply_to = self::getRawAddress($raw_reply_to); | |||||
| $user = PhabricatorUser::loadOneWithEmailAddress($reply_to); | |||||
| if ($user) { | |||||
| return $user; | |||||
| } else { | |||||
| $reasons[] = pht( | |||||
| 'Phabricator is configured to authenticate users using the '. | |||||
| '"Reply-To" header, but the reply address ("%s") on this '. | |||||
| 'message does not correspond to any known user account.', | |||||
| $raw_reply_to); | |||||
| } | |||||
| } else { | |||||
| $reasons[] = pht( | |||||
| '(Phabricator is not configured to authenticate users using the '. | |||||
| '"Reply-To" header, so it was ignored.)'); | |||||
| } | |||||
| } | |||||
| // If we don't know who this user is, load or create an external user | // If we don't know who this user is, load or create an external user | ||||
| // account for them if we're configured for it. | // account for them if we're configured for it. | ||||
| $email_key = 'phabricator.allow-email-users'; | $email_key = 'phabricator.allow-email-users'; | ||||
| $allow_email_users = PhabricatorEnv::getEnvConfig($email_key); | $allow_email_users = PhabricatorEnv::getEnvConfig($email_key); | ||||
| if ($allow_email_users) { | if ($allow_email_users) { | ||||
| $from_obj = new PhutilEmailAddress($from); | $from_obj = new PhutilEmailAddress($from); | ||||
| $xuser = id(new PhabricatorExternalAccountQuery()) | $xuser = id(new PhabricatorExternalAccountQuery()) | ||||
| ->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
| ▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines | |||||