private function dropEmptyMail(PhabricatorMetaMTAReceivedMail $mail) { $body = $mail->getCleanTextBody(); $attachments = $mail->getAttachments(); if (strlen($body) || $attachments) { return; } // Only send an error email if the user is talking to just Phabricator. // We can assume if there is only one "To" address it is a Phabricator // address since this code is running and everything. $is_direct_mail = count($mail->getToAddresses()) == 1 && count($mail->getCCAddresses()) == 0; if ($is_direct_mail) { $status_code = MetaMTAReceivedMailStatus::STATUS_EMPTY; } else { $status_code = MetaMTAReceivedMailStatus::STATUS_EMPTY_IGNORED; } throw new PhabricatorMetaMTAReceivedMailProcessingException($status_code, pht('Your message does not contain any body text or attachments, so ' . 'Phabricator can not do anything useful with it. Make sure comment ' . 'text appears at the top of your message: quoted replies, inline ' . 'text, and signatures are discarded and ignored.')); }
/** * Only send an error email if the user is talking to just Phabricator. We * can assume if there is only one To address it is a Phabricator address * since this code is running and everything. */ private function shouldSendErrorEmail(PhabricatorMetaMTAReceivedMail $mail) { return count($mail->getToAddresses() == 1) && count($mail->getCCAddresses() == 0); }