unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Vida Gábor" <vidagabor@gmail.com>
Cc: 7589@debbugs.gnu.org
Subject: bug#7589: smtpmail: bad line endings in queued mails on Windows
Date: Fri, 10 Dec 2010 16:36:06 +0200	[thread overview]
Message-ID: <83lj3x1yqx.fsf@gnu.org> (raw)
In-Reply-To: <kod0zkshdv1k.fsf@gmail.com>

> Date: Wed, 08 Dec 2010 00:26:15 +0100
> From: Vida Gábor <vidagabor@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)







  reply	other threads:[~2010-12-10 14:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07 23:26 bug#7589: smtpmail: bad line endings in queued mails on Windows Vida Gábor
2010-12-10 14:36 ` Eli Zaretskii [this message]
2010-12-11  9:43   ` Vida Gábor
2010-12-11 10:07     ` Eli Zaretskii
2010-12-12 19:40       ` Vida Gábor
2010-12-12 20:12         ` Eli Zaretskii
2010-12-13  8:59           ` Vida Gábor
2010-12-13 15:13             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83lj3x1yqx.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=7589@debbugs.gnu.org \
    --cc=vidagabor@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).