From 570a78d42af78cf1aac657c64cf08c5cc75f92c2 Mon Sep 17 00:00:00 2001 From: Tal Shiri Date: Thu, 17 Jul 2014 18:32:44 -0700 Subject: [PATCH] don't add email addresses to CC if they are already in TO Summary: Some mailers remove the duplicate entries themselves, but some (Mailgun) don't. This affects installations with metamta.one-mail-per-recipient set to false, and will cause - ugly looking "to" entries. Gmail, for example, collapses to+cc entries to one list, so you get something that looks like "to: me me john" - It sometimes causes duplicate delivery of the same message when used in conjuction with Google Groups. I suspect that their message de-dup mechanism is confused by it (I fuzzed it directly with Mailgun, and saw the same message delivered twice - once directly through mailgun, and bounced again through Google Groups). This doesn't happen when the entries are not duplicated. Test Plan: Created some tasks. Added subscribers. Things seem to work reasonably well. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9978 --- src/applications/metamta/storage/PhabricatorMetaMTAMail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php index 545ad9c822..e5445b0abf 100644 --- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php +++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php @@ -606,7 +606,7 @@ final class PhabricatorMetaMTAMail extends PhabricatorMetaMTADAO { } $add_to = array_unique($add_to); - $add_cc = array_unique($add_cc); + $add_cc = array_diff(array_unique($add_cc), $add_to); $mailer->addTos($add_to); if ($add_cc) {