Subject: [PATCH] git-send-email.perl: check for lines longer than 998 characters

From: Adam Piątyszek <[email-masked]>
Date: Fri, 18 Jan 2008 08:47:38 +0100

According to RFC2822 (Internet Message Format), each line of a message
must be no more than 998 characters. This patch adds a check for the
length of each body line of a message and dies if the length exceeds
the limit.

Signed-off-by: Adam Piątyszek <[email-masked]>
---
 git-send-email.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index e47994a..6d623ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -748,6 +748,9 @@ foreach my $t (@files) {
 				$header_done = 1;
 			}
 		} else {
+			if (length($_) > 998) {
+				die "(msg) This message contains lines longer than 998 characters,\nwhich can not be correctly send as plain text using SMTP.\n";
+			}
 			$message .=  $_;
 			if (/^(Signed-off-by|Cc): (.*)$/i && $signed_off_cc) {
 				my $c = $2;
-- 
1.5.4.rc3.4.g1633