@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't set mail HTML bodies if there's no actual HTML body

Summary:
See <https://discourse.phabricator-community.org/t/commit-6011085b0fcd-breaks-sending-certain-email/1571>. Some mailers get upset if we `setHTMLBody(...)` with an empty string.

There's some possible argument they should be more graceful about this, but it's reasonably pretty ambiguous.

Only try to set the HTML body if we actually have a nonempty HTML body.

Test Plan:
- Configured an "smtp" mailer.
- Ran `echo hi | ./bin/mail send-test --to someone@somewhere.com --subject test`.
- Before: error about empty message body.
- After: no more message body error.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D19494

+8 -7
+8 -7
src/applications/metamta/storage/PhabricatorMetaMTAMail.php
··· 917 917 918 918 if ($send_html) { 919 919 $html_body = idx($params, 'html-body'); 920 - 921 - // NOTE: We just drop the entire HTML body if it won't fit. Safely 922 - // truncating HTML is hard, and we already have the text body to fall 923 - // back to. 924 - if (strlen($html_body) <= $body_limit) { 925 - $mailer->setHTMLBody($html_body); 926 - $body_limit -= strlen($html_body); 920 + if (strlen($html_body)) { 921 + // NOTE: We just drop the entire HTML body if it won't fit. Safely 922 + // truncating HTML is hard, and we already have the text body to fall 923 + // back to. 924 + if (strlen($html_body) <= $body_limit) { 925 + $mailer->setHTMLBody($html_body); 926 + $body_limit -= strlen($html_body); 927 + } 927 928 } 928 929 } 929 930