summaryrefslogtreecommitdiff
path: root/it_mail.class
diff options
context:
space:
mode:
authorDavid Flatz2016-02-05 12:12:07 +0100
committerDavid Flatz2016-02-05 12:13:04 +0100
commit66a0c9f49176ec3309b94ea232fbbd92735454ae (patch)
treef9ad417c5e8817be6bb2cf0fe3ff277f0a53996c /it_mail.class
parent06dbabffb1d0cbae2a707968b2cd34a996d23171 (diff)
downloaditools-66a0c9f49176ec3309b94ea232fbbd92735454ae.tar.gz
itools-66a0c9f49176ec3309b94ea232fbbd92735454ae.tar.bz2
itools-66a0c9f49176ec3309b94ea232fbbd92735454ae.zip
use php function to escape headers; don't swallow double quotes when escaping, this should fix bounces when realname contains umlauts and komma; be a little pedantic about whitespace in addrlist
Diffstat (limited to 'it_mail.class')
-rw-r--r--it_mail.class8
1 files changed, 4 insertions, 4 deletions
diff --git a/it_mail.class b/it_mail.class
index 73b0bd7..aa242c5 100644
--- a/it_mail.class
+++ b/it_mail.class
@@ -305,7 +305,7 @@ function send($p = array())
function header_escape($string)
{
return preg_match('/[\x00-\x1f\x7f-\xff]/', $string)
- ? ("=?{$this->charset}?Q?" . str_replace(" ", "_", preg_replace_callback('/[\x00-\x1f=\x7f-\xff]/', function($m) { return sprintf('=%02X', ord($m[0])); }, trim($string, ' "'))) . "?=")
+ ? ltrim(iconv_mime_encode('', $string, array('scheme' => 'Q', 'input-charset' => $this->charset, 'output-charset' => $this->charset)), ' :')
: $string;
}
@@ -332,12 +332,12 @@ function addrlist_escape($string)
foreach ((array)$mailboxes as $mailbox)
{
if (preg_match('/^(.*)(\s+?<[^>]+@[^>]+>\s*)$/', $mailbox, $matches))
- $result[] = $this->header_escape($matches[1]) . $matches[2];
+ $result[] = $this->header_escape(trim($matches[1])) . $matches[2];
else
- $result[] = $mailbox;
+ $result[] = trim($mailbox);
}
- return implode(',', $result);
+ return implode(', ', $result);
}