backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 38 forks source link

DefaultMailSystem::format() incorrectly calls backdrop_wrap_mail() #6471

Open avpaderno opened 3 months ago

avpaderno commented 3 months ago

This is the equivalent of DefaultMailSystem implements MailSystemInterface::format() incorrectly for Drupal 7.

DefaultMailSystem::format() contains the following code.

$message['body'] = backdrop_html_to_text($message['body']);
// Wrap the mail body for sending.
$message['body'] = backdrop_wrap_mail($message['body']);

The description for backdrop_html_to_text() says:

The output will be suitable for use as 'format=flowed; delsp=yes' text (RFC 3676) and can be passed directly to backdrop_mail()() for sending.

backdrop_wrap_mail() converts all soft breaks into hard breaks, making 'format=flowed' meaningless.

klonos commented 3 months ago

I have reviewed the code and it matches the respective code that is RTBC for D7. I have left a suggestion in the PR to consider adding a comment improvement/clarification, but this is otherwise RTBC.

Not sure how to test this though.

quicksketch commented 3 months ago

Thanks @klonos! @kiamlaluno I think this needs instructions for testing. Will this affect the emails that Backdrop sends, like welcome emails and password resets?

The D7 issue was marked RTBC by @kiamlaluno (although someone else provided the patch in 2019). So I guess there's already 2 people that feel it's ready on the Drupal side.

avpaderno commented 2 months ago

I apologize: I think I wrongly added the pr - needs testing label.

herbdool commented 4 weeks ago

This does seem to be correct.