Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
| Show First 20 Lines • Show All 283 Lines • ▼ Show 20 Lines | final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { | ||||
| */ | */ | ||||
| public function setThreadID($thread_id, $is_first_message = false) { | public function setThreadID($thread_id, $is_first_message = false) { | ||||
| $this->setParam('thread-id', $thread_id); | $this->setParam('thread-id', $thread_id); | ||||
| $this->setParam('is-first-message', $is_first_message); | $this->setParam('is-first-message', $is_first_message); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| /** | /** | ||||
| * Save a newly created mail to the database and attempt to send it | * Save a newly created mail to the database. The mail will eventually be | ||||
| * immediately if the server is configured for immediate sends. When | * delivered by the MetaMTA daemon. | ||||
| * applications generate new mail they should generally use this method to | |||||
| * deliver it. If the server doesn't use immediate sends, this has the same | |||||
| * effect as calling save(): the mail will eventually be delivered by the | |||||
| * MetaMTA daemon. | |||||
| * | * | ||||
| * @return this | * @return this | ||||
| */ | */ | ||||
| public function saveAndSend() { | public function saveAndSend() { | ||||
| $ret = null; | return $this->save(); | ||||
| if (PhabricatorEnv::getEnvConfig('metamta.send-immediately')) { | |||||
| $ret = $this->sendNow(); | |||||
| } else { | |||||
| $ret = $this->save(); | |||||
| } | |||||
| return $ret; | |||||
| } | } | ||||
| protected function didWriteData() { | protected function didWriteData() { | ||||
| parent::didWriteData(); | parent::didWriteData(); | ||||
| if (!$this->getWorkerTaskID()) { | if (!$this->getWorkerTaskID()) { | ||||
| $mailer_task = PhabricatorWorker::scheduleTask( | $mailer_task = PhabricatorWorker::scheduleTask( | ||||
| 'PhabricatorMetaMTAWorker', | 'PhabricatorMetaMTAWorker', | ||||
| ▲ Show 20 Lines • Show All 521 Lines • Show Last 20 Lines | |||||