Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
Show First 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | final class PhabricatorMetaMTAMail | ||||
public function setMailStampMetadata($metadata) { | public function setMailStampMetadata($metadata) { | ||||
return $this->setParam('stampMetadata', $metadata); | return $this->setParam('stampMetadata', $metadata); | ||||
} | } | ||||
public function getMailStampMetadata() { | public function getMailStampMetadata() { | ||||
return $this->getParam('stampMetadata', array()); | return $this->getParam('stampMetadata', array()); | ||||
} | } | ||||
public function getMailerKey() { | |||||
return $this->getParam('mailer.key'); | |||||
} | |||||
public function setHTMLBody($html) { | public function setHTMLBody($html) { | ||||
$this->setParam('html-body', $html); | $this->setParam('html-body', $html); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getBody() { | public function getBody() { | ||||
return $this->getParam('body'); | return $this->getParam('body'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | foreach ($mailers as $template_mailer) { | ||||
->save(); | ->save(); | ||||
throw $ex; | throw $ex; | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
$exceptions[] = $ex; | $exceptions[] = $ex; | ||||
continue; | continue; | ||||
} | } | ||||
// Keep track of which mailer actually ended up accepting the message. | |||||
$mailer_key = $mailer->getKey(); | |||||
if ($mailer_key !== null) { | |||||
$this->setParam('mailer.key', $mailer_key); | |||||
} | |||||
return $this | return $this | ||||
->setStatus(PhabricatorMailOutboundStatus::STATUS_SENT) | ->setStatus(PhabricatorMailOutboundStatus::STATUS_SENT) | ||||
->save(); | ->save(); | ||||
} | } | ||||
// If we make it here, no mailer could send the mail but no mailer failed | // If we make it here, no mailer could send the mail but no mailer failed | ||||
// permanently either. We update the error message for the mail, but leave | // permanently either. We update the error message for the mail, but leave | ||||
// it in the current status (usually, STATUS_QUEUE) and try again later. | // it in the current status (usually, STATUS_QUEUE) and try again later. | ||||
▲ Show 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | private function buildMailer(PhabricatorMailImplementationAdapter $mailer) { | ||||
$add_to = array_unique($add_to); | $add_to = array_unique($add_to); | ||||
$add_cc = array_diff(array_unique($add_cc), $add_to); | $add_cc = array_diff(array_unique($add_cc), $add_to); | ||||
$mailer->addTos($add_to); | $mailer->addTos($add_to); | ||||
if ($add_cc) { | if ($add_cc) { | ||||
$mailer->addCCs($add_cc); | $mailer->addCCs($add_cc); | ||||
} | } | ||||
// Keep track of which mailer actually ended up accepting the message. | |||||
$mailer_key = $mailer->getKey(); | |||||
if ($mailer_key !== null) { | |||||
$this->setParam('mailer.key', $mailer_key); | |||||
} | |||||
return $mailer; | return $mailer; | ||||
} | } | ||||
private function generateThreadIndex($seed, $is_first_mail) { | private function generateThreadIndex($seed, $is_first_mail) { | ||||
// When threading, Outlook ignores the 'References' and 'In-Reply-To' | // When threading, Outlook ignores the 'References' and 'In-Reply-To' | ||||
// headers that most clients use. Instead, it uses a custom 'Thread-Index' | // headers that most clients use. Instead, it uses a custom 'Thread-Index' | ||||
// header. The format of this header is something like this (from | // header. The format of this header is something like this (from | ||||
// camel-exchange-folder.c in Evolution Exchange): | // camel-exchange-folder.c in Evolution Exchange): | ||||
▲ Show 20 Lines • Show All 552 Lines • Show Last 20 Lines |