diff --git a/git-send-email.perl b/git-send-email.perl index ae9f869..b11dce8 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1365,7 +1365,14 @@ Message-Id: $message_id $smtp->mail( $raw_from ) or die $smtp->message; $smtp->to( @recipients ) or die $smtp->message; $smtp->data or die $smtp->message; - $smtp->datasend("$header\n$message") or die $smtp->message; + # Apparently datasend cannot send more than about 16 and large patches + # cannot be sent. Source: + # http://git.661346.n2.nabble.com/git-send-email-Connection-Closed-td7635648.html + $smtp->datasend("$header\n") or die $smtp->message; + my @lines = split /^/, $message; + foreach my $line (@lines) { + $smtp->datasend("$line") or die $smtp->message; + } $smtp->dataend() or die $smtp->message; $smtp->code =~ /250|200/ or die "Failed to send $subject\n".$smtp->message; }