From: "Karl Hasselström" <kha@treskal.com>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] QP-encode email body
Date: Sun, 22 Oct 2006 14:49:37 +0200 [thread overview]
Message-ID: <20061022124937.14051.37985.stgit@localhost> (raw)
In-Reply-To: <20061022124551.14051.25145.stgit@localhost>
From: Karl Hasselström <kha@treskal.com>
Some mail servers dislike the 8bit transfer encoding, so use
quoted-printable instead.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
stgit/commands/mail.py | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index b661308..885d5e9 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -15,7 +15,7 @@ along with this program; if not, write t
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os, re, time, datetime, smtplib, email.Header, email.Utils
+import sys, os, re, time, datetime, quopri, smtplib, email.Header, email.Utils
from optparse import OptionParser, make_option
from stgit.commands.common import *
@@ -253,7 +253,7 @@ def __build_extra_headers():
"""Build extra headers like content-type etc.
"""
headers = 'Content-Type: text/plain; charset=utf-8; format=fixed\n'
- headers += 'Content-Transfer-Encoding: 8bit\n'
+ headers += 'Content-Transfer-Encoding: quoted-printable\n'
headers += 'User-Agent: StGIT/%s\n' % version.version
return headers
@@ -425,9 +425,9 @@ def encode_header(s, enc):
else:
return s
-def encode_headers(msg, enc):
- """rfc2047-encode the headers of msg, assuming it is encoded in
- enc."""
+def encode_message(msg, enc):
+ """rfc2047-encode the headers of msg, and quoted-printable-encode
+ the body. msg is assumed to be encoded in enc."""
in_header = True
lines = []
for line in msg.splitlines(True):
@@ -436,6 +436,8 @@ def encode_headers(msg, enc):
line = encode_header(line, enc)
else:
in_header = False
+ else:
+ line = quopri.encodestring(line)
lines.append(line)
return ''.join(lines)
@@ -497,7 +499,7 @@ def func(parser, options, args):
raise CmdException, 'No cover message template file found'
msg_id = email.Utils.make_msgid('stgit')
- msg = encode_headers(__build_cover(tmpl, total_nr, msg_id, options),
+ msg = encode_message(__build_cover(tmpl, total_nr, msg_id, options),
'UTF-8')
from_addr, to_addr_list = __parse_addresses(msg)
@@ -524,7 +526,7 @@ def func(parser, options, args):
for (p, patch_nr) in zip(patches, range(1, len(patches) + 1)):
msg_id = email.Utils.make_msgid('stgit')
- msg = encode_headers(__build_message(tmpl, p, patch_nr, total_nr,
+ msg = encode_message(__build_message(tmpl, p, patch_nr, total_nr,
msg_id, ref_id, options), 'UTF-8')
from_addr, to_addr_list = __parse_addresses(msg)
prev parent reply other threads:[~2006-10-22 12:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-22 12:02 [PATCH] RFC2047-encode email headers Karl Hasselström
2006-10-22 12:12 ` Karl Hasselström
2006-10-22 12:45 ` [PATCH 0/2] Make "stg mail" behave better with non-ascii characters Karl Hasselström
2006-10-22 12:49 ` [PATCH 1/2] RFC2047-encode email headers Karl Hasselström
2006-10-22 12:49 ` Karl Hasselström [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=20061022124937.14051.37985.stgit@localhost \
--to=kha@treskal.com \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.