From 6deddbfc701db50a70f4de0fab78ec4f46074557 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sun, 31 Jul 2011 11:54:50 -0700 Subject: [PATCH] Better enforce uniqueness for email delivery Summary: @skrul reports receiving multiple copies of notification emails since @hunterbridges configured some bizarre dystopian email replication factory on their outbound route. Two fixes: - Ensure "To" and "Cc" are unique. Email shouldn't be replicated for "To: x@y.com, x@y.com" but it's silly that we do this. - Remove "To" addresses from "Cc". Email shouldn't be replicated here either, but we don't really lose anything by accommodating this. Test Plan: Sent a mail to the same to/cc, verified I was to'd only and not cc'd when the mail was delivered. @hunterbridges, can you apply this patch locally and verify it fixes the issue? You can test by going to MetaMTA -> Send New Message and sending a message to yourself as both To and CC. Reviewed By: skrul Reviewers: skrul, hunterbridges, jungejason, tuomaspelkonen, aran CC: aran, skrul, epriestley Differential Revision: 751 --- .../metamta/storage/mail/PhabricatorMetaMTAMail.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php index 2251d3ac63..4b4cb0a537 100644 --- a/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/mail/PhabricatorMetaMTAMail.php @@ -88,11 +88,13 @@ class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { } public function addTos(array $phids) { + $phids = array_unique($phids); $this->setParam('to', $phids); return $this; } public function addCCs(array $phids) { + $phids = array_unique($phids); $this->setParam('cc', $phids); return $this; }