[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7589: smtpmail: bad line endings in queued mails on Windows

From: Eli Zaretskii
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 <address@hidden>
> 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.


=== 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
-               (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)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]