GNU bug report logs - #7589
smtpmail: bad line endings in queued mails on Windows

Previous Next

Package: emacs;

Reported by: Vida Gábor <vidagabor <at> gmail.com>

Date: Tue, 7 Dec 2010 23:24:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vida Gábor <vidagabor <at> gmail.com>
Cc: 7589 <at> debbugs.gnu.org
Subject: bug#7589: smtpmail: bad line endings in queued mails on Windows
Date: Fri, 10 Dec 2010 16:36:06 +0200
> Date: Wed, 08 Dec 2010 00:26:15 +0100
> From: Vida Gábor <vidagabor <at> gmail.com>
> 
> This problem comes only if `smtpmail-queue-mail' is set to `t'.
> 
> When I'm ready with the mail, smtpmail-send-it is called and it tries to
> save the mail to disk. It is ok, but if I open the file with
> find-file-literally, then I see an additional ^M character at the end of
> each line. This causes problem (at least with MS Exchange) when I send
> it: the mail received by the recipient has empty body. This is sure that
> this additional ^M causes the problem (if I set smtpmail-queue-mail to
> nil, the smtpmail trace shows only one ^M at the end of each line).
> 
> I tried to understand what and where is the problem in the code, but the
> only conclusion was that if smtpmail reads the saved mail without
> conversion (coding-system-for-read set to 'no-conversion), then it
> should save it using Unix-style line endings.

I think your analysis is correct.  Could you please try the patch
below?  If it works for you, I will install it on the Emacs 23 branch,
so that it will be available in the upcoming Emacs 23.3 release.

Thanks.

=== modified file 'lisp/mail/smtpmail.el'
--- lisp/mail/smtpmail.el	2010-12-09 01:46:03 +0000
+++ lisp/mail/smtpmail.el	2010-12-10 14:32:28 +0000
@@ -392,7 +392,13 @@ The list is in preference order.")
 		(make-directory smtpmail-queue-dir t))
 	      (with-current-buffer buffer-data
 		(erase-buffer)
-		(set-buffer-file-coding-system smtpmail-code-conv-from nil t)
+		(set-buffer-file-coding-system
+		 ;; We will be reading the file with no-conversion in
+		 ;; smtpmail-send-queued-mail below, so write it out
+		 ;; with Unix EOLs.
+		 (coding-system-change-eol-conversion smtpmail-code-conv-from
+						      'unix)
+		 nil t)
 		(insert-buffer-substring tembuf)
 		(write-file file-data)
 		(set-buffer buffer-elisp)






This bug report was last modified 14 years and 217 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.