From db1f1e31ca60658d605b7a60c7d43a3e37aa8923 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 29 Jul 2010 04:12:44 -0400
Subject: [PATCH] - Include all recipients in sendmail log

---
 CHANGELOG                   |    1 +
 program/steps/mail/func.inc |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index aab214b..c454b6d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Include all recipients in sendmail log
 - Support HTTP_X_FORWARDED_PROTO header for HTTPS detecting (#1486866)
 - Fix default IMAP port configuration (#1486864)
 - Create Sent folder when starting to compose a new message (#1486802)
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 9d6d96d..a1cc68d 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1444,6 +1444,14 @@
     // remove MDN headers after sending
     unset($headers['Return-Receipt-To'], $headers['Disposition-Notification-To']);
 
+    // get all recipients
+    if ($headers['Cc'])
+      $mailto .= $headers['Cc'];
+    if ($headers['Bcc'])
+      $mailto .= $headers['Bcc'];
+    if (preg_match_all('/<([^@]+@[^>]+)>/', $mailto, $m))
+      $mailto = implode(', ', array_unique($m[1]));
+
     if ($CONFIG['smtp_log']) {
       write_log('sendmail', sprintf("User %s [%s]; Message for %s; %s",
         $RCMAIL->user->get_username(),

--
Gitblit v1.9.1