Can I prevent HTML code from showing in e-mail subject lines?

Can I prevent HTML code from showing in e-mail subject lines?

by Steve Ambro v3.8 -
Number of replies: 8

I use HTML code for color, size, and style in the names of my activities.

When an e-mail message is sent, the HTML code shows in the subject line. 
Can this be cleaned up?

Here is a picture of what my students, receive:
I



Average of ratings: -
In reply to Steve Ambro v3.8

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Depending on the version of Moodle you are running, possibly the eMail is a template and thus can be overridden in a theme and at that point the message cleaned up with a core / PHP function / method.  For example, the forum eMail is altered in the Campus theme: https://github.com/dasistwas/moodle-theme_campus/commit/462ff19bea18a4ac56ed41e1e6117869f182ab1e.   This is not trivial to do or understand!

Or there might be a core 'text' only eMail setting.

In reply to Gareth J Barnard

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Steve Ambro v3.8 -

Text Only is probably not the answer, the HTML is not active in the title rather it is being shown as text.

There is little probability that something deep in the bowels of Moodle will carry any weight.  I will have to fire up my home Moodle system to work it out.

I seem to be the only one here that uses HTML in the titles.

In reply to Steve Ambro v3.8

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

By 'text only' I mean that the core setting will remove the HTML!!!

In reply to Gareth J Barnard

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Steve Ambro v3.8 -

I know of a setting that might be that to which you refer.  This one will remove all HTML from every activity title.  This is not what I want.  I just want to clean up the e-mail subject line.

In reply to Steve Ambro v3.8

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok, I'm talking about a 'text only' eMail setting.  If that's still not what you want then you'll need to start looking at the code, find out where the eMail is sent from for that particular element and then work out a solution whereby it only cleans up the subject lines of activity eMails.

In reply to Gareth J Barnard

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Steve Ambro v3.8 -

In the example given for custom headers has 787 lines changed.  Since I am probably the only one using HTML for my activity titles, I doubt I am going to convince anyone with the authority to make the changes. (:

I was hoping for a simple check box.
It also seems that no one else here uses HTML this way.



In reply to Steve Ambro v3.8

Re: Can I prevent HTML code from showing in e-mail subject lines?

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Sorry, the headers (Subject: is a header) of e-mail are there amoung other things to describe in the body, for example that it will be HTML-formatted. Obviously, then the header itself can not be HTML formatted. Think of the headers as an introduction to a speech where you announce for example the speech is in Chinese. You can't make that announcement in Chinese, can you?