diff options
author | uckelman <uckelman@nomic.net> | 2010-11-25 12:09:52 +0000 |
---|---|---|
committer | uckelman <uckelman@nomic.net> | 2010-11-25 12:09:52 +0000 |
commit | 8fce94b07f795cc5ea2ec31938d4ac1066eb022d (patch) | |
tree | 86b4cf039fd7282b2f83dbbcae0fc864c78ef90a /src | |
parent | ba56609798b023768410c3ada7f9784c5e150ac7 (diff) |
* Broke out From construction.
* Fixed RFC822 quoting bug.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@7499 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'src')
-rw-r--r-- | src/build_email.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/build_email.php b/src/build_email.php index 5301106..41344ca 100644 --- a/src/build_email.php +++ b/src/build_email.php @@ -78,10 +78,29 @@ function build_body(array &$headers, $text, $attachments, $footer) { return $body; } +function build_from($name, $email) { + $qname = ''; + + if (is_ascii($name)) { + if (has_rfc822_specials($name)) { + $qname = rfc822_quote($name); + } + else { + $qname = $name; + } + } + else { + // base64-encode if we have non-ASCII chars + $qname = utf8_quote($name); + } + + return sprintf('%s <%s>', $qname, $email); +} + function build_headers($userName, $userEmail, $to, $sender, $subject, $edit, $time, $messageId, $forumURL, $inReplyTo, $references) { - $from = sprintf('%s <%s>', utf8_quote_non_ascii($userName), $userEmail); + $from = build_from($userName, $userEmail); $subject = utf8_quote_non_ascii($subject); $date = date(DATE_RFC2822, $time); |