Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/receiver/PhabricatorObjectMailReceiver.php
Show First 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | final public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) { | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
private function matchObjectAddressInMail( | private function matchObjectAddressInMail( | ||||
PhabricatorMetaMTAReceivedMail $mail) { | PhabricatorMetaMTAReceivedMail $mail) { | ||||
foreach ($mail->getToAddresses() as $address) { | foreach ($mail->newTargetAddresses() as $address) { | ||||
$parts = $this->matchObjectAddress($address); | $parts = $this->matchObjectAddress($address); | ||||
if ($parts) { | if ($parts) { | ||||
return $parts; | return $parts; | ||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
private function matchObjectAddress($address) { | private function matchObjectAddress(PhutilEmailAddress $address) { | ||||
$regexp = $this->getAddressRegexp(); | $address = PhabricatorMailUtil::normalizeAddress($address); | ||||
$local = $address->getLocalPart(); | |||||
$address = self::stripMailboxPrefix($address); | |||||
$local = id(new PhutilEmailAddress($address))->getLocalPart(); | |||||
$regexp = $this->getAddressRegexp(); | |||||
$matches = null; | $matches = null; | ||||
if (!preg_match($regexp, $local, $matches)) { | if (!preg_match($regexp, $local, $matches)) { | ||||
return false; | return false; | ||||
} | } | ||||
return $matches; | return $matches; | ||||
} | } | ||||
Show All 33 Lines |