From 1648706cd85d2b8ea72c7e365f130cebaf6dadfd Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Sat, 26 Jan 2002 02:57:54 +0000 Subject: [PATCH] . original commit: b316f184496c72e844aa26ccbe5bbf5ec42a0eef --- collects/net/sendmail-unit.ss | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/collects/net/sendmail-unit.ss b/collects/net/sendmail-unit.ss index d84311a..e874eb0 100644 --- a/collects/net/sendmail-unit.ss +++ b/collects/net/sendmail-unit.ss @@ -68,18 +68,29 @@ (let loop ((to recipients) (indent header-space)) (if (null? to) (newline writer) - (let ((first (car to))) + (let ((first (car to)) + [rest (cdr to)]) (let ((len (string-length first))) (if (>= (+ len indent) 80) (begin - (fprintf writer "~n ~a, " first) - (loop (cdr to) (+ len header-space 2))) + (fprintf writer + (if (null? rest) + "~n ~a" + "~n ~a, ") + first) + (loop (cdr to) + (+ len header-space 2))) (begin - (fprintf writer "~a, " first) + (fprintf writer + (if (null? rest) + "~a " + "~a, ") + first) (loop (cdr to) (+ len indent 2)))))))))))) (write-recipient-header "To" to-recipients) - (write-recipient-header "CC" cc-recipients)) + (unless (null? cc-recipients) + (write-recipient-header "CC" cc-recipients))) (fprintf writer "Subject: ~a~n" subject) (fprintf writer "X-Mailer: MzScheme: see www.plt-scheme.org~n") (for-each (lambda (s)