aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2009-06-03 16:29:26 +0000
committerChris Smith <toonarmy@phpbb.com>2009-06-03 16:29:26 +0000
commit05548f8f05d1f64945a4fdb615f0e4e1620323c2 (patch)
tree871c5303f319353e17e6b8fc86d9706005d72cc1 /phpBB/includes
parent8fc412f26aa1b6e580b8aa200db79608b19aeae9 (diff)
downloadforums-05548f8f05d1f64945a4fdb615f0e4e1620323c2.tar
forums-05548f8f05d1f64945a4fdb615f0e4e1620323c2.tar.gz
forums-05548f8f05d1f64945a4fdb615f0e4e1620323c2.tar.bz2
forums-05548f8f05d1f64945a4fdb615f0e4e1620323c2.tar.xz
forums-05548f8f05d1f64945a4fdb615f0e4e1620323c2.zip
Correctly split UTF-8 encoded strings when using mail(). #45815
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9530 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_messenger.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 4fd5fd19e0..4916ee41d7 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -408,6 +408,8 @@ class messenger
$this->from = '<' . $config['board_contact'] . '>';
}
+ $encode_eol = ($config['smtp_delivery']) ? "\r\n" : $this->eol;
+
// Build to, cc and bcc strings
$to = $cc = $bcc = '';
foreach ($this->addresses as $type => $address_ary)
@@ -419,7 +421,7 @@ class messenger
foreach ($address_ary as $which_ary)
{
- $$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . mail_encode($which_ary['name']) . '" <' . $which_ary['email'] . '>' : $which_ary['email']);
+ $$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . mail_encode($which_ary['name'], $encode_eol) . '" <' . $which_ary['email'] . '>' : $which_ary['email']);
}
}
@@ -443,7 +445,7 @@ class messenger
$headers = implode($this->eol, $headers);
ob_start();
- $result = $config['email_function_name']($mail_to, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers);
+ $result = $config['email_function_name']($mail_to, mail_encode($this->subject, $this->eol), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $headers);
$err_msg = ob_get_clean();
}
@@ -688,7 +690,7 @@ class queue
else
{
ob_start();
- $result = $config['email_function_name']($to, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), implode($this->eol, $headers));
+ $result = $config['email_function_name']($to, mail_encode($subject, $this->eol), wordwrap(utf8_wordwrap($msg), 997, "\n", true), implode($this->eol, $headers));
$err_msg = ob_get_clean();
}
@@ -1441,13 +1443,15 @@ class smtp_class
* is basically doomed with an unreadable subject.
*
* Please note that this version fully supports RFC 2045 section 6.8.
+*
+* @param string $eol End of line we are using (optional to be backwards compatible)
*/
-function mail_encode($str)
+function mail_encode($str, $eol = "\r\n")
{
// define start delimimter, end delimiter and spacer
$start = "=?UTF-8?B?";
$end = "?=";
- $delimiter = "\r\n ";
+ $delimiter = "$eol ";
// Maximum length is 75. $split_length *must* be a multiple of 4, but <= 75 - strlen($start . $delimiter . $end)!!!
$split_length = 60;