Merge branch 'sa/send-email-smtp-batch-data-limit' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Nov 2015 20:18:06 +0000 (12:18 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Nov 2015 20:18:06 +0000 (12:18 -0800)
When "git send-email" wanted to talk over Net::SMTP::SSL,
Net::Cmd::datasend() did not like to be fed too many bytes at the
same time and failed to send messages. Send the payload one line
at a time to work around the problem.

* sa/send-email-smtp-batch-data-limit:
git-send-email.perl: Fixed sending of many/huge changes/patches

git-send-email.perl
index e3ff44b4d0cd25f247138d9ead160d2aedff5033..e907e0eacf31c21dcb75fa102eb980d6a51f96c3 100755 (executable)
@@ -1365,7 +1365,11 @@ sub send_message {
                $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;
+               $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;
        }