git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@gmail.com>
To: Pavel Roskin <proski@gnu.org>
Cc: git@vger.kernel.org, Karl Wiberg <kha@treskal.com>,
	Alex Chiang <achiang@hp.com>
Subject: Re: [StGit PATCH] mail: Ask for the SMTP credentials before sending  the messages
Date: Mon, 1 Mar 2010 15:46:13 +0000	[thread overview]
Message-ID: <b0943d9e1003010746l1d4208bas48fcfba36efa5605@mail.gmail.com> (raw)
In-Reply-To: <1266015411.25535.21.camel@mj>

On 12 February 2010 22:56, Pavel Roskin <proski@gnu.org> wrote:
> On Fri, 2010-02-12 at 16:11 +0000, Catalin Marinas wrote:
>> The original implementation was asking for the SMTP password on every
>> patch sent. This patch only asks the password once before sending or
>> even editing the cover message and patches.
>
> I don't have time to investigate at the moment, but "make test" fails in
> t1900-mail.sh on the "proposed" branch, which includes this patch:

The patch was converting the message headers to Header objects rather
than strings so that the long-line folding is done using "\n " rather
than "\n\t" (Outlook cannot handle the latter correctly). But it looks
like the Python library assumes that they are strings and getting
"content-type" fails (I would say Python bug).

Anyway, I change the patch so that it only converts the the Subject
header which is the one that bothers me most:


commit 1b0c0113861681974b8905dbe10a57f6831ecb87
Author: Catalin Marinas <catalin.marinas@gmail.com>
Date:   Fri Feb 12 15:36:37 2010 +0000

    mail: Use space rather than tab for long subject header folding

    The default Python implementation (at least 2.5 and earlier) fold long
    e-mail header lines by inserting "\n\t". This causes issues with some
    e-mail clients that remove both "\n\t". The RFC2822 shows that folding
    should be done with "\n ". The Python workaround is to use a Header
    object instead of a string when setting the message headers.

    Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>

diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index d0334b4..ed55fd9 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -426,6 +426,13 @@ def __encode_message(msg):
         new_val = ' '.join(words)
         msg.replace_header(header, new_val)

+    # replace the Subject string with a Header() object otherwise the long
+    # line folding is done using "\n\t" rather than "\n ", causing issues with
+    # some e-mail clients
+    subject = msg.get('subject', '')
+    msg.replace_header('subject',
+                       email.Header.Header(subject, header_name = 'subject'))
+
     # encode the body and set the MIME and encoding headers
     if msg.is_multipart():
         for p in msg.get_payload():



-- 
Catalin

      reply	other threads:[~2010-03-01 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 16:11 [StGit PATCH] mail: Ask for the SMTP credentials before sending the messages Catalin Marinas
2010-02-12 22:42 ` Pavel Roskin
2010-02-12 22:56 ` Pavel Roskin
2010-03-01 15:46   ` Catalin Marinas [this message]

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

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

  git send-email \
    --in-reply-to=b0943d9e1003010746l1d4208bas48fcfba36efa5605@mail.gmail.com \
    --to=catalin.marinas@gmail.com \
    --cc=achiang@hp.com \
    --cc=git@vger.kernel.org \
    --cc=kha@treskal.com \
    --cc=proski@gnu.org \
    /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.
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 NNTP newsgroup(s).