summaryrefslogtreecommitdiffstats
path: root/system/libraries/Email.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2016-01-26 15:34:08 +0100
committerAndrey Andreev <narf@devilix.net>2016-01-26 15:34:08 +0100
commitcd32356021fbf83dc2cb27b9fe35472f08d10892 (patch)
treefe52eef1c11765fe3d9ddd9562e0f58c891f120b /system/libraries/Email.php
parent1e77136c47032221ae0cdb7f6b43f56792dae224 (diff)
parent8ec82e2885d60847331e88f22ecffa71feafcb61 (diff)
Merge branch '3.0-stable' into develop
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r--system/libraries/Email.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 007f9b431..ed6f737a1 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -574,14 +574,18 @@ class CI_Email {
$this->validate_email($this->_str_to_array($replyto));
}
- if ($name === '')
- {
- $name = $replyto;
- }
-
- if (strpos($name, '"') !== 0)
+ if ($name !== '')
{
- $name = '"'.$name.'"';
+ // only use Q encoding if there are characters that would require it
+ if ( ! preg_match('/[\200-\377]/', $name))
+ {
+ // add slashes for non-printing characters, slashes, and double quotes, and surround it in double quotes
+ $name = '"'.addcslashes($name, "\0..\37\177'\"\\").'"';
+ }
+ else
+ {
+ $name = $this->_prep_q_encoding($name);
+ }
}
$this->set_header('Reply-To', $name.' <'.$replyto.'>');