diff options
author | Aleksander Machniak <alec@alec.pl> | 2014-11-14 08:48:56 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2014-11-14 08:50:12 +0100 |
commit | 4446aea1e64361065e2cf902ada004546599fd0b (patch) | |
tree | fe59ce3b1dbc02105e7c899c76b5b119238ef0f3 /program | |
parent | 33f8bd69180567f82c1c0f0773beff01e65ec688 (diff) |
Fix lack of delimiter for recipient addresses in smtp_log (#1490150)
Diffstat (limited to 'program')
-rw-r--r-- | program/lib/Roundcube/rcube.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 8f39c7a70..6582d89a3 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1458,7 +1458,7 @@ class rcube // send thru SMTP server using custom SMTP library if ($this->config->get('smtp_server')) { // generate list of recipients - $a_recipients = array($mailto); + $a_recipients = (array) $mailto; if (strlen($headers['Cc'])) $a_recipients[] = $headers['Cc']; @@ -1558,19 +1558,24 @@ class rcube // 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 ($this->config->get('smtp_log')) { + // get all recipient addresses + if (is_array($mailto)) { + $mailto = implode(',', $mailto); + } + if ($headers['Cc']) { + $mailto .= ',' . $headers['Cc']; + } + if ($headers['Bcc']) { + $mailto .= ',' . $headers['Bcc']; + } + + $mailto = rcube_mime::decode_address_list($mailto, null, false, null, true); + self::write_log('sendmail', sprintf("User %s [%s]; Message for %s; %s", $this->user->get_username(), - $_SERVER['REMOTE_ADDR'], - $mailto, + rcube_utils::remote_addr(), + implode(', ', $mailto), !empty($response) ? join('; ', $response) : '')); } } |