From 4faad5b3f1d6092489da7f4ff74c54c34cc1cdd0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 31 Jan 2011 21:13:38 -0800 Subject: [PATCH] Add a default-send behavior to MetaMTA. --- conf/default.conf.php | 6 ++++++ scripts/daemons/metamta/metamta_mta.php | 3 +++ .../storage/mail/PhabricatorMetaMTAMail.php | 15 +++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 scripts/daemons/metamta/metamta_mta.php diff --git a/conf/default.conf.php b/conf/default.conf.php index 9003515814..ee9cbf31bb 100644 --- a/conf/default.conf.php +++ b/conf/default.conf.php @@ -66,6 +66,12 @@ return array( 'user.default-profile-image-phid' => 'PHID-FILE-f57aaefce707fc4060ef', + // When email is sent, try to hand it off to the MTA immediately. The only + // reason to disable this is if your MTA infrastructure is completely + // terrible. If you disable this option, you must run the 'metamta_mta.php' + // daemon or mail won't be handed off to the MTA. + 'metamta.send-immediately' => true, + ); diff --git a/scripts/daemons/metamta/metamta_mta.php b/scripts/daemons/metamta/metamta_mta.php new file mode 100644 index 0000000000..e3906efd34 --- /dev/null +++ b/scripts/daemons/metamta/metamta_mta.php @@ -0,0 +1,3 @@ +setParam('simulated-failures', $count); return $this; } + + public function save() { + $try_send = (PhabricatorEnv::getEnvConfig('metamta.send-immediately')) && + (!$this->getID()); + + $ret = parent::save(); + + if ($try_send) { + $mailer = new PhabricatorMailImplementationPHPMailerLiteAdapter(); + $this->sendNow($force_send = false, $mailer); + } + + return $ret; + } + public function sendNow( $force_send = false,