diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -766,10 +766,14 @@ } if ($config_attach) { - $name = pht('D%s.%s.patch', $object->getID(), $diff->getID()); - $mime_type = 'text/x-patch; charset=utf-8'; - $body->addAttachment( - new PhabricatorMetaMTAAttachment($patch, $name, $mime_type)); + // See T12033, T11767, and PHI55. This is a crude fix to stop the + // major concrete problems that lackluster email size limits cause. + if (strlen($patch) < $body_limit) { + $name = pht('D%s.%s.patch', $object->getID(), $diff->getID()); + $mime_type = 'text/x-patch; charset=utf-8'; + $body->addAttachment( + new PhabricatorMetaMTAAttachment($patch, $name, $mime_type)); + } } } }