Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancellation emails incorrectly send plaintext as html, leading to email clients incorrectly formatting them #139

Open
matthewhilton opened this issue Feb 19, 2024 · 2 comments
Assignees

Comments

@matthewhilton
Copy link
Contributor

matthewhilton commented Feb 19, 2024

Imagine you have the cancellation email text set as the following:

Hello
Your booking has been cancelled
Thank you

If you were to cancel this booking, the user would get two emails (which is a different issue, see #60)

The email without the .ics attachment will show normally, i.e. what is above. However, the email with the .ics attachment would be joined into a single line, e.g.:

Hello Your booking has been cancelled Thank you

This looks to be because when sending cancellation emails, when sending the .ics email here:

moodle-mod_facetoface/lib.php

Lines 2260 to 2261 in 10d6966

if (!email_to_user($user, $from, $attachment['subject'], $attachment['body'],
$attachment['htmlbody'], $attachment['filename'], $attachmentfilename)) {

Both the $messagehtml and $messagetext are set as plaintext (no html), i.e.:

Hello
Your booking has been cancelled
Thank you

Which leads to email clients interpreting this message as html, but since there are no line breaks, etc... it joins it all into a single one line string.

This does not seem to happen with confirmation messages, because they use a html editor and probably format the text into both html and plaintext properly, instead of the cancellation messages which just use the normal plain textarea editor.

@matthewhilton matthewhilton changed the title Cancellation emails send HTML but don't actually Cancellation emails incorrectly send plaintext as html, leading to email clients incorrectly formatting them Feb 19, 2024
@matthewhilton
Copy link
Contributor Author

This seems to not just be limited to cancellation emails, have seen it happen as well to confirmation emails.

@matthewhilton matthewhilton self-assigned this Aug 8, 2024
@matthewhilton
Copy link
Contributor Author

May also be related to #146 - I think the details field is an editor in the form, but under the hood is using html_to_text

$msg = str_replace(get_string('placeholder:details', 'facetoface'), html_to_text(format_text($data->details)), $msg);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant