Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/receiver/PhabricatorMailReceiver.php
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | if ($allow_email_users) { | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->loadOneOrCreate(); | ->loadOneOrCreate(); | ||||
return $xuser->getPhabricatorUser(); | return $xuser->getPhabricatorUser(); | ||||
} else { | } else { | ||||
// NOTE: Currently, we'll always drop this mail (since it's headed to | |||||
// an unverified recipient). See T12237. These details are still useful | |||||
// because they'll appear in the mail logs and Mail web UI. | |||||
$reasons[] = pht( | $reasons[] = pht( | ||||
'Phabricator is also not configured to allow unknown external users '. | 'Phabricator is also not configured to allow unknown external users '. | ||||
'to send mail to the system using just an email address.'); | 'to send mail to the system using just an email address.'); | ||||
$reasons[] = pht( | $reasons[] = pht( | ||||
'To interact with Phabricator, add this address ("%s") to your '. | 'To interact with Phabricator, add this address ("%s") to your '. | ||||
'account.', | 'account.', | ||||
$raw_from); | $raw_from); | ||||
} | } | ||||
if ($this->getApplicationEmail()) { | if ($this->getApplicationEmail()) { | ||||
$application_email = $this->getApplicationEmail(); | $application_email = $this->getApplicationEmail(); | ||||
$default_user_phid = $application_email->getConfigValue( | $default_user_phid = $application_email->getConfigValue( | ||||
PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR); | PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR); | ||||
if ($default_user_phid) { | if ($default_user_phid) { | ||||
$user = id(new PhabricatorUser())->loadOneWhere( | $user = id(new PhabricatorUser())->loadOneWhere( | ||||
'phid = %s', | 'phid = %s', | ||||
$default_user_phid); | $default_user_phid); | ||||
if ($user) { | if ($user) { | ||||
return $user; | return $user; | ||||
} | } | ||||
} | |||||
$reasons[] = pht( | $reasons[] = pht( | ||||
"Phabricator is misconfigured, the application email ". | 'Phabricator is misconfigured: the application email '. | ||||
"'%s' is set to user '%s' but that user does not exist.", | '"%s" is set to user "%s", but that user does not exist.', | ||||
$application_email->getAddress(), | $application_email->getAddress(), | ||||
$default_user_phid); | $default_user_phid); | ||||
} | } | ||||
} | |||||
$reasons = implode("\n\n", $reasons); | $reasons = implode("\n\n", $reasons); | ||||
throw new PhabricatorMetaMTAReceivedMailProcessingException( | throw new PhabricatorMetaMTAReceivedMailProcessingException( | ||||
MetaMTAReceivedMailStatus::STATUS_UNKNOWN_SENDER, | MetaMTAReceivedMailStatus::STATUS_UNKNOWN_SENDER, | ||||
$reasons); | $reasons); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |