summaryrefslogtreecommitdiff
path: root/email
diff options
context:
space:
mode:
Diffstat (limited to 'email')
-rw-r--r--email/email.scm16
1 files changed, 15 insertions, 1 deletions
diff --git a/email/email.scm b/email/email.scm
index ff0f5e9..22d9739 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -957,7 +957,21 @@ For example,
(match-lambda
((('name . name)
('address . address))
- (format #f "~a <~a>" name address))
+ (string-append
+ ;; Quote display names with illegal characters.
+ (let ((char-set:atext (char-set-intersection
+ char-set:ascii
+ (char-set-union char-set:letter
+ char-set:digit
+ (char-set #\! #\# #\$ #\%
+ #\& #\' #\* #\+
+ #\- #\/ #\= #\?
+ #\^ #\_ #\` #\{
+ #\| #\} #\~)))))
+ (if (string-every char-set:atext name)
+ name
+ (string-append "\"" name "\"")))
+ " <" address ">"))
((('address . address)) address)))
(define (parse-email-body headers body)