From 02461e0e2833753151ed71899f075c94e5fc495b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Thu, 8 Oct 2009 10:03:26 -0700 Subject: [PATCH] git-send-email.perl: fold multiple entry "Cc:" and multiple single line "RCPT TO:"s Some MTAs reject Cc: lines longer than 78 chars. Avoid this by using the same join as "To:" ",\n\t" so each subsequent Cc entry is on a new line. RCPT TO: should have a single entry per line. see: http://www.ietf.org/rfc/rfc2821.txt Signed-off-by: Joe Perches Signed-off-by: Junio C Hamano --- git-send-email.perl | 6 ++- t/t9001-send-email.sh | 94 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 78 insertions(+), 22 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 0700d80af..e188a8949 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -835,7 +835,7 @@ sub send_message $gitversion = Git::version(); } - my $cc = join(", ", unique_email_list(@cc)); + my $cc = join(",\n\t", unique_email_list(@cc)); my $ccline = ""; if ($cc ne '') { $ccline = "\nCc: $cc"; @@ -976,7 +976,9 @@ X-Mailer: git-send-email $gitversion if ($smtp_server !~ m#^/#) { print "Server: $smtp_server\n"; print "MAIL FROM:<$raw_from>\n"; - print "RCPT TO:".join(',',(map { "<$_>" } @recipients))."\n"; + foreach my $entry (@recipients) { + print "RCPT TO:<$entry>\n"; + } } else { print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n"; } diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index fb606a9f0..84a7f03d4 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -103,10 +103,18 @@ cat >expected-show-all-headers <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: cc@example.com, A , One , two@example.com +Cc: cc@example.com, + A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -164,7 +172,7 @@ test_expect_success 'cccmd works' ' --smtp-server="$(pwd)/fake.sendmail" \ cccmd.patch \ && - grep ^Cc:.*cccmd@example.com msgtxt1 + grep "^ cccmd@example.com" msgtxt1 ' z8=zzzzzzzz @@ -278,10 +286,17 @@ cat >expected-suppress-sob <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: cc@example.com, A , One , two@example.com +Cc: cc@example.com, + A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -318,10 +333,15 @@ cat >expected-suppress-sob <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com +Cc: A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -344,10 +364,17 @@ cat >expected-suppress-cccmd <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com, C O Mitter +Cc: A , + One , + two@example.com, + C O Mitter Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -392,10 +419,17 @@ cat >expected-suppress-body <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com, cc-cmd@example.com +Cc: A , + One , + two@example.com, + cc-cmd@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -416,10 +450,15 @@ cat >expected-suppress-body-cccmd <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com +Cc: A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -440,10 +479,15 @@ cat >expected-suppress-sob <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com +Cc: A , + One , + two@example.com Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -466,10 +510,17 @@ cat >expected-suppress-bodycc <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,,,, +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , One , two@example.com, C O Mitter +Cc: A , + One , + two@example.com, + C O Mitter Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -489,10 +540,13 @@ cat >expected-suppress-cc <<\EOF Dry-OK. Log says: Server: relay.example.com MAIL FROM: -RCPT TO:,, +RCPT TO: +RCPT TO: +RCPT TO: From: Example To: to@example.com -Cc: A , C O Mitter +Cc: A , + C O Mitter Subject: [PATCH 1/1] Second. Date: DATE-STRING Message-Id: MESSAGE-ID-STRING @@ -605,7 +659,7 @@ test_expect_success 'utf8 Cc is rfc2047 encoded' ' --to=nobody@example.com \ --smtp-server="$(pwd)/fake.sendmail" \ outdir/*.patch && - grep "^Cc:" msgtxt1 | + grep "^ " msgtxt1 | grep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= " ' -- 2.30.2