--- smtp.scm.orig 2006-04-19 21:27:12.000000000 +0200 +++ smtp.scm 2006-04-19 22:03:11.000000000 +0200 @@ -99,17 +99,20 @@ (cons to1 to) ) (send smtp "DATA") (fetch smtp) - (let ([last #f]) + (let ([bol #t]) (make-output-port (lambda (s) (let ([len (string-length s)]) (when (fx>= len 1) - (when (and last (char=? #\. (string-ref s 0))) - (write-char #\. (smtp-out smtp)) ) - (display s (smtp-out smtp)) - (when (char=? #\newline (string-ref s (fx- len 1))) - (set! last #t)) ) ) ) + (when (and bol (char=? #\. (string-ref s 0))) + (write-char #\. (smtp-out smtp))) + (display + (string-translate* s '(("\r\n." . "\r\n.."))) + (smtp-out smtp)) + (set! bol (char=? #\newline (string-ref s (fx- len 1)))) ) ) ) (lambda () + (unless bol + (display "\r\n")) (display ".\r\n" (smtp-out smtp)) (fetch smtp) (smtp-open-set! smtp #f) ) ) ) )