Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61617

Messages email should use HTML



    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.4
    • None
    • Messages


      On the Messaging system i.e. /message/index.php :

      You can type HTML into a message (italics or h1 tags) and it'll display in the web UI inside the little speech bubble with the text in the tags heading-sized or itacized etc.

      The recipient of that message if they are online and visit the messaging system will similarly see the renderered HTML in the web UI.

      I believe this is because the FORMAT_MOODLE text format is the default of the web service and the web front end isn't specifying another format in it's web service call so that's the format you are typing in, which accepts HTML as well as converting line breaks etc.

      The email that is sent out with the message content when they are offline is on the other hand treated as plain text so they will see the tags as typed, not as displayed in the browser, in a plain text email. No HTML email version is provided.

      This seems a bit inconsistent, I would have expected it to be treated similarly to a forum post, where the HTML the user enters is presented in the email as it would be in the browser, regardless of the original format used to enter it.

      I think where this goes wrong is message_send_message function in message/lib.php.

      In that function it will only send and HTML version if the FORMAT_HTML is what is passed in. I would have expected an HTML version of anything, even if it started off as FORMAT_PLAIN, and definately if FORMAT_MOODLE is used.

      It then does something else a little odd further down, where it appends a string of minus signs as a kind of divider before the footer with the text "This is a copy of a message sent to you at "testsite". Go to to reply."

      A bunch of minus signs and a url inserted as plain text make sense for plain text emails, but is a bit strange for HTML emails. There is some small allowance for HTML emails here, as \n linebreaks are converted to <br> tags, but I would have expected the line of minuses to be an <hr> tag and the text to have an actual <a> tag link that takes you to the messaging web interface.I would have thought most people who aren't specifically requesting plain text emails, would be confused to recieve one from Moodle, when other emails are often HTML. It might be worth checking for any other types of email that are plain text only and providing both versions.


        Issue Links



              Unassigned Unassigned
              bawjaws David Scotson
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              3 Vote for this issue
              8 Start watching this issue