{"thread":{"id":"20278","subject":"[PATCH] post-receive-email: Set content-type and encoding in generated mail","startedAt":"2009-07-29T13:48:24Z","lastAt":"2009-07-31T01:52:15Z","messageCount":5,"participants":["Fabian Emmes","Teemu Likonen","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"119060","messageId":"1248875304-13167-1-git-send-email-emmes@informatik.rwth-aachen.de","threadId":"20278","inReplyTo":null,"subject":"[PATCH] post-receive-email: Set content-type and encoding in generated mail","fromName":"Fabian Emmes","fromEmail":"emmes@informatik.rwth-aachen.de","sentAt":"2009-07-29T13:48:24Z","receivedAt":"2009-07-29T13:48:24Z","isPatch":true,"sender":{"key":"emmes@informatik.rwth-aachen.de","avatar":null},"body":"Add proper content-type header to mails generated by post-receive-email, as\nsuggested by Alexander Gerasiov in\nhttp://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg588535.html\n\nSigned-off-by: Fabian Emmes <emmes@informatik.rwth-aachen.de>\n---\n contrib/hooks/post-receive-email |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\nindex 2a66063..0c50155 100755\n--- a/contrib/hooks/post-receive-email\n+++ b/contrib/hooks/post-receive-email\n@@ -197,6 +197,7 @@ generate_email_header()\n \tcat <<-EOF\n \tTo: $recipients\n \tSubject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe\n+\tContent-Type: text/plain; charset=utf-8\n \tX-Git-Refname: $refname\n \tX-Git-Reftype: $refname_type\n \tX-Git-Oldrev: $oldrev\n-- \n1.6.3.1.9.g95405b\n"},{"id":"119061","messageId":"87tz0vwpvc.fsf@iki.fi","threadId":"20278","inReplyTo":"1248875304-13167-1-git-send-email-emmes@informatik.rwth-aachen.de","subject":"Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2009-07-29T14:00:39Z","receivedAt":"2009-07-29T14:00:39Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"On 2009-07-29 15:48 (+0200), Fabian Emmes wrote:\n\n> Add proper content-type header to mails generated by post-receive-email, as\n> suggested by Alexander Gerasiov in\n> http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg588535.html\n>\n> Signed-off-by: Fabian Emmes <emmes@informatik.rwth-aachen.de>\n> ---\n>  contrib/hooks/post-receive-email |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\n> index 2a66063..0c50155 100755\n> --- a/contrib/hooks/post-receive-email\n> +++ b/contrib/hooks/post-receive-email\n> @@ -197,6 +197,7 @@ generate_email_header()\n>  \tcat <<-EOF\n>  \tTo: $recipients\n>  \tSubject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe\n> +\tContent-Type: text/plain; charset=utf-8\n>  \tX-Git-Refname: $refname\n>  \tX-Git-Reftype: $refname_type\n>  \tX-Git-Oldrev: $oldrev\n\nThat's not complete. You need all these:\n\n    MIME-Version: 1.0\n    Content-Type: text/plain; charset=utf-8\n    Content-Transfer-Encoding: 8bit\n"},{"id":"119065","messageId":"20090729144610.GA5060@coredump.intra.peff.net","threadId":"20278","inReplyTo":"1248875304-13167-1-git-send-email-emmes@informatik.rwth-aachen.de","subject":"Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-07-29T14:46:11Z","receivedAt":"2009-07-29T14:46:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 29, 2009 at 03:48:24PM +0200, Fabian Emmes wrote:\n\n> --- a/contrib/hooks/post-receive-email\n> +++ b/contrib/hooks/post-receive-email\n> @@ -197,6 +197,7 @@ generate_email_header()\n>  \tcat <<-EOF\n>  \tTo: $recipients\n>  \tSubject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe\n> +\tContent-Type: text/plain; charset=utf-8\n>  \tX-Git-Refname: $refname\n>  \tX-Git-Reftype: $refname_type\n>  \tX-Git-Oldrev: $oldrev\n\nShouldn't this be $(git config i18n.logOutputEncoding), since you will\nbe inserting the output of git rev-list into the mail?\n\nAnd as Teemu mentioned, you need a mime-version and a transfer-encoding\nheader, as well.\n\nSo maybe (totally untested):\n\n---\ndiff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\nindex 2a66063..0c1c6ad 100755\n--- a/contrib/hooks/post-receive-email\n+++ b/contrib/hooks/post-receive-email\n@@ -192,11 +192,16 @@ generate_email()\n \n generate_email_header()\n {\n+\tencoding=`git config i18n.logOutputEncoding`\n+\ttest -z \"$encoding\" && encoding=utf-8\n \t# --- Email (all stdout will be the email)\n \t# Generate header\n \tcat <<-EOF\n \tTo: $recipients\n \tSubject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe\n+\tMIME-Version: 1.0\n+\tContent-Type: text/plain; charset=$encoding\n+\tContent-Transfer-Encoding: 8bit\n \tX-Git-Refname: $refname\n \tX-Git-Reftype: $refname_type\n \tX-Git-Oldrev: $oldrev\n"},{"id":"119160","messageId":"20090730080206.GR31428@hebe.informatik.RWTH-Aachen.DE","threadId":"20278","inReplyTo":"20090729144610.GA5060@coredump.intra.peff.net","subject":"Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail","fromName":"Fabian Emmes","fromEmail":"emmes@informatik.rwth-aachen.de","sentAt":"2009-07-30T08:02:06Z","receivedAt":"2009-07-30T08:02:06Z","isPatch":true,"sender":{"key":"emmes@informatik.rwth-aachen.de","avatar":null},"body":"Hi,\n\nthanks Teemu and Jeff for correcting the errors. Indeed I assumed that\ngit log would always output UTF-8 and a \"Content-Type\" header would be\nvalid on its own. The patch of Jeff solves my problem. I tested the\nresults in mutt, kmail and thunderbird.\n\nRegards,\nFabian\n\nOn 29. Jul, 10:46, Jeff King wrote:\n> On Wed, Jul 29, 2009 at 03:48:24PM +0200, Fabian Emmes wrote:\n> \n> > --- a/contrib/hooks/post-receive-email\n> > +++ b/contrib/hooks/post-receive-email\n> > @@ -197,6 +197,7 @@ generate_email_header()\n> >  \tcat <<-EOF\n> >  \tTo: $recipients\n> >  \tSubject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe\n> > +\tContent-Type: text/plain; charset=utf-8\n> >  \tX-Git-Refname: $refname\n> >  \tX-Git-Reftype: $refname_type\n> >  \tX-Git-Oldrev: $oldrev\n> \n> Shouldn't this be $(git config i18n.logOutputEncoding), since you will\n> be inserting the output of git rev-list into the mail?\n> \n> And as Teemu mentioned, you need a mime-version and a transfer-encoding\n> header, as well.\n> \n> So maybe (totally untested):\n> \n> ---\n> diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email\n> index 2a66063..0c1c6ad 100755\n> --- a/contrib/hooks/post-receive-email\n> +++ b/contrib/hooks/post-receive-email\n> @@ -192,11 +192,16 @@ generate_email()\n>  \n>  generate_email_header()\n>  {\n> +\tencoding=`git config i18n.logOutputEncoding`\n> +\ttest -z \"$encoding\" && encoding=utf-8\n>  \t# --- Email (all stdout will be the email)\n>  \t# Generate header\n>  \tcat <<-EOF\n>  \tTo: $recipients\n>  \tSubject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe\n> +\tMIME-Version: 1.0\n> +\tContent-Type: text/plain; charset=$encoding\n> +\tContent-Transfer-Encoding: 8bit\n>  \tX-Git-Refname: $refname\n>  \tX-Git-Reftype: $refname_type\n>  \tX-Git-Oldrev: $oldrev\n\n-- \nFabian Emmes           mailto:emmes@informatik.rwth-aachen.de\nLuFG Informatik 2      http://verify.rwth-aachen.de/emmes/\nRWTH Aachen            phone: +49 241 80-21241\n"},{"id":"119206","messageId":"20090731015215.GC11392@coredump.intra.peff.net","threadId":"20278","inReplyTo":"20090730080206.GR31428@hebe.informatik.RWTH-Aachen.DE","subject":"Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-07-31T01:52:15Z","receivedAt":"2009-07-31T01:52:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Jul 30, 2009 at 10:02:06AM +0200, Fabian Emmes wrote:\n\n> thanks Teemu and Jeff for correcting the errors. Indeed I assumed that\n> git log would always output UTF-8 and a \"Content-Type\" header would be\n> valid on its own. The patch of Jeff solves my problem. I tested the\n> results in mutt, kmail and thunderbird.\n\nGreat. Would you mind re-submitting the patch you tested with a\nproper write-up in the commit message?\n\n-Peff\n"}]}