Messaging: HTML code in emails from messaging...

Messaging: HTML code in emails from messaging...

by Jennelle Torrey -
Number of replies: 21

We are running Moodle 1.7.2 and we have the messaging feature turned off which means that when a teacher goes to participants and selects students and sends them a message the message goes to their email.

What is happening is that some emails come throught very nicely formatted and look the way an email should. Others come through with HTML coding in them - see example below.

This seems to be hapening very randomly - any ideas as to how to fix this?

EXAMPLE:

I am looking for some ...

Message-ID: <<font color="#0000ff">a6da4f1bef25aabc02d51418f9c94b56@courses.roberts.edu</font>>

X-Priority: 3

X-Mailer: PHPMailer [version Moodle 2006101020]

MIME-Version: 1.0

Content-Type: multipart/alternative;

boundary="b1_a6da4f1bef25aabc02d51418f9c94b56"

--b1_a6da4f1bef25aabc02d51418f9c94b56

Content-Type: text/plain; charset = "UTF-8"

Content-Transfer-Encoding: quoted-printable

HI Class,

I am looking for some feedback on today's class with the computer = hardware.

Reply to this email and give me your thoughts? Is there any topic that we = did not cover that you woudl liek to knwo more about?

Thank you for your reply.

Jennelle

--

This email is a copy of a message sent to you at "Courses"

https://courses.roberts.edu/message/index.php?popup=3D1

--b1_a6da4f1bef25aabc02d51418f9c94b56

Content-Type: text/html; charset = "UTF-8"

Content-Transfer-Encoding: quoted-printable

<p>HI Class,</p>

<p>I am looking for some feedback on today's class with the computer = hardware. Reply to this email and give me your thoughts? Is there any = topic that we did not cover that you woudl liek to knwo more about?</p> <p>Thank you for your reply.</p> <p>Jennelle</p><hr /><p><a = href=3D"https://courses.roberts.edu/message/index.php?popup=3D1">This = email is a copy of a message sent to you at "Courses"</a></p>

--b1_a6da4f1bef25aabc02d51418f9c94b56--

Average of ratings: -
In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by Lucy Mellersh -
Dear Jenelle,

I'm having exactly the same problem!
It's not due to the restricted messaging - everybody can message on our site.

The email forwards come through with varying degrees of clutter (sometimes including all the header information and an html duplicate of the text as in your mail). The problem only seems to affect some people.

We're running moodle 1.6

Lucy
In reply to Lucy Mellersh

Re: Messaging: HTML code in emails from messaging...

by Jennelle Torrey -

Thank you for your post Lucy,

Have you found a solution to this yet?

Jennelle

In reply to Lucy Mellersh

Re: Messaging: HTML code in emails from messaging...

by Jack Tsao -
Same problem, anyone can help?
In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by Haydon Rouse -
We're having similar problems with the format of emails received (via Outlook). Header information and html code is appearing, making the email difficult to read.
Does anyone have a solution?
In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by Nessa Johnston -

Hi Jenelle,

We're having the same problem too, and it seems to be happening quite randomly, so I've hit a wall.

I checked to see if the teachers who had mentioned the problem had their format set to plain text or to html, and they all had it set to plain text, so I'm not sure why all this code appears in the students' emails.

Sorry, I don't have a solution, just chiming in to say we're having the same problem!

Nessa

In reply to Nessa Johnston

Re: Messaging: HTML code in emails from messaging...

by Marcus Hoberg -

We are having the same: emails get to the students including unreadable html code and Message-ID info.

Is there anybody around who fixed the above described email issue?

It seems to occur in various moodle versions (we are driving 1.8.4).

It does only occur when using Internet Explorer (6 and 7; sorry, company standard).

With IE it happes randomly: approx. 5% get through properly, 95% corrupt.

When using Firefox 2 all mails get through properly.

Where are the entries that really define the email coding? Found /moodle/lib/phpmailer/class.phpmailer.php with general settings for the mailer. And /moodle/lib/moodlelib.php with additional entries. Following variables seem important: $CharSet, $ContentType, $Encoding. What is Content-Transfer-Encoding standing for???

Marcus

In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by JD Hall -
Same problem here. We're using Moodle 1.8.2.

Is the Quickmail Block a possible work-around or is it essentially the same?

- JD
In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by Van Howell -

Has there been a solution to this. I am using 1.8.2 and have the same problems.

Here's an example.

-----------------------------------------------------------------------------
Clarification - I didn't intentionally set a deadline of 11am on the 10th =
for
the research questions.=C2=A0 It must be a default.=C2=A0 The assignment =
is due 10th
by=C2=A0 midnight please.


Also, if my emails from moodle are coming to you with weird symbols =
etc.=C2=A0
Let me know so I can see what is going on.

-----------------------------------------------------------------------------

It is random for us.

In reply to Van Howell

Re: Messaging: HTML code in emails from messaging...

by Chris Potter -
To give this a bump, we've been experiencing the same issue. I presume it can be resolved by changing the message format from "Plain Text" (by default) in the Moodle User's profile to "HTML Format", BUT... depending on your release of Moodle, it might not generate those "preferences" until after they visit the "Settings" tab in the message window and click "Save changes". I've got 1045 users at last count, and it doesn't happen to most, but it does happen to some... leaving it an annoyance to go through and change them all (especially when we get 600-1000 new users per year at least).

Anyone with any thoughts?
In reply to Chris Potter

Re: Messaging: HTML code in emails from messaging...

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Enough folks seem to be experiencing this that it seems like it may be a bug. The obvious thing to me would be that it is related to Plain Text vs HTML in the user's profile; however, I read that someone had ruled that out. Please file a bug in the tracker at tracker.moodle.org and make reference to this discussion thread (i.e. http://moodle.org/mod/forum/discuss.php?d=79871) Peace - Anthony
In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by Jason Bowers -
We have the same problem. Still no fix?
In reply to Jason Bowers

Re: Messaging: HTML code in emails from messaging...

by Shane Hendrix -

My guess is that everyone, or most, are receiving their e-mail via an exchange server?

I too am having this problem so I did some testing and best I can tell is that Exchange server does not like quoted-printable content-transfer-encoding.  I remarked out the following line from my lib\moodlelib.php file:
$mail->Encoding = 'quoted-printable';

Everything seems to work fine now.  I don't believe this setting is necessary.

In reply to Shane Hendrix

Re: Messaging: HTML code in emails from messaging...

by Chris Potter -
Interesting... can anyone confirm that this works (or should work)? What line is it on?
In reply to Chris Potter

Re: Messaging: HTML code in emails from messaging...

by Shane Hendrix -

Line 4026 using version 1.9.

It is working for me, however my logic may be incorrect.  I don't think it is my incoming mail server that wasn't liking the quoted-printable message, but rather my out going SMTP server.  I read another thread about sending your e-mail via SMTP's Anonymous authentication and the security in place for that.  (I have anon authenticated virtual smtp set up, but I only allow a bank of Iocal IP addresses to send).  Seems there is a possibility that for security reasons anon SMTP won't perform the content transfer encode, and the solution should be as simple as using "Basic" or "Integrated" authentication instead of "Anonymous".

I am going to try out this solution as well.  I'd feel a lot better if I didn't have to comment out lines of code.  (Though I still question the validity of this setting).

So maybe the commonality amongst us is actually that we are all sending via anonymous authenticated SMTP (windows server/IIS)?

In reply to Shane Hendrix

Re: Messaging: HTML code in emails from messaging...

by Chris Potter -
I user a username and password for authentication to our SMTP server (we have an account used specifically for that purpose). I'm not that familiar with SMTP. Does this mean we fit your category also??
In reply to Chris Potter

Re: Messaging: HTML code in emails from messaging...

by Shane Hendrix -

You may have ruled out that idea then Chris, though there are multiple authentications w/ SMTP (users to use the service, who can relay, who can send outbound, etc).  I can definetly say this much, the issue for me is in the "quoted-printable" encoding and that commenting out that line mentioned above fixes my problem.  I'm just trying to find the real culprit, something is not properly processing the encoding and I'm pretty sure its outgoing SMTP.  For example, the e-mail messages I receive from forum posts here at moodle.org have the quoted-printable encoding set within the header and they read just fine.  I have coded up some PHP scripts on the same server to send e-mail using "quoted-printable" encoding, and they read just fine... though moodle is sending multipart messages w/ boundries (e-mail contains the message in more then one format and it is identified by boundries) and this senerio I haven't been able to recreate in my small PHP script.  *shrug*.  I realize this may be a bit cryptic.  I'll continue to look at it and see if I can find a better solution.

In reply to Shane Hendrix

Re: Messaging: HTML code in emails from messaging...

by Shane Hendrix -

Sure enough.  I unremarked the "quoted-printable" line in code and changed my authentication from anonymous to basic in SMTP outbound messages, performed some tests and the email received is formatted properly.  Found the same solution on another thread here:  http://moodle.org/mod/forum/discuss.php?d=19886

Viewing the properties of your SMTP virtual server, it'll be under the "Delivery" tab & clicking the "Outbound Security" button.  Should be the same in either IIS or Exchange System Manager. 

In reply to Jennelle Torrey

Re: Messaging: HTML code in emails from messaging...

by Dr. Nellie Deutsch -

I get an error message when I click on the link to reply. Here's what I get in my email box from the discussion forums on Moodle 2.2

This is a copy of a message posted on the M4TEVO2013 website.

To reply click on this link:
http://www.integrating-technology.org/mod/forum/post.php?reply=3D32294

 

--b1_b4f370d0f059c82d2a63ac2904638e79
Content-Type: text/html; charset = "UTF-8"
Content-Transfer-Encoding: quoted-printable

<head></head>
<body id=3D"email">

<div class="3D""navbar"><a target=3D"_blank" href=3D"http://www.integrating-t=
echnology.org/course/view.php?id=3D433">M4TEVO2013</a> &raquo; <a target=3D=
"_blank" href=3D"http://www.integrating-technology.org/mod/forum/index.php?=
id=3D433">Forums</a> &raquo; <a target=3D"_blank" href=3D"http://www.integr=
ating-technology.org/mod/forum/view.php?f=3D2934">
Introductions</a> &raquo; <a target=3D"_blank" href=3D"http://www.integrati=
ng-technology.org/mod/forum/discuss.php?d=3D8638">Introduction</a></div><ta=
ble border=3D"0" cellpadding=3D"3" cellspacing=3D"0" class="3D""forumpost"><t=
r class="3D""header"><td width=3D"35" valign=3D"top" class="3D""picture left"><=
a href=3D"http://www.integrating-technology.org/user/view.php?id=3D1348&amp=
;course=3D433"><img src=3D"http://www.integrating-technology.org/pluginfile=
=2Ephp/1806/user/icon/aardvark/f2" alt=3D"Nan Zingrone" title=3D"Nan Zingrone=
" class="3D""userpicture" width=3D"35" height=3D"35" /></a></td><td class="3D""=
topic"><div class="3D""subject">Re: Introduction</div><div class="3D""author">b=
y <a href=3D"http://www.integrating-technology.org/user/view.php?id=3D1348&=
amp;course=3D433">Nan Zingrone</a> - Friday, January 25, 2013, 12:18 AM</di=
v></td></tr><tr><td class="3D""left side" valign=3D"top">&nbsp;</td><td class=
=3D"content"><p>
You will have fun!
</p>
<p>
As you go through the course remember to ask people for help if
something does not make sense, or if you think it is hard to do
and you need some help. The best way to learn is by teaching each
other! <img class="3D""emoticon" alt=3D"thoughtful" title=3D"thoughtful" sr=
c=3D"http://www.integrating-technology.org/theme/image.php?theme=3Daardvark=
&amp;image=3Ds%2Fthoughtful&amp;rev=3D343" />
</p><div class="3D""commands"><a target=3D"_blank" href=3D"http://www.integra=
ting-technology.org/mod/forum/discuss.php?d=3D8638&amp;parent=3D32209">Show=
parent</a> | <a target=3D"_blank" href=3D"http://www.integrating-technolog=
y.org/mod/forum/post.php?reply=3D32294">Reply</a></div><div class="3D""link">=
<a target=3D"_blank" href=3D"http://www.integrating-technology.org/mod/foru=
m/discuss.php?d=3D8638#p32294">See this post in context</a></div></td></tr>=
</table>

</body>


--b1_b4f370d0f059c82d2a63ac2904638e79--

In reply to Dr. Nellie Deutsch

Re: Messaging: HTML code in emails from messaging...

by Sakshi Goel -

Hi ,

I have facing a same issue when email goes at self-registration in moodle 3.1

I fixed this issue by going to  Administration > Site administration >︎ Plugins >︎ Message outputs >︎ Email

And set "LF" as option for "Newline characters in mail"



In reply to Sakshi Goel

Re: Messaging: HTML code in emails from messaging...

by Dr. Nellie Deutsch -

I am now getting it again on Moodle 2.9 with Essential. 

I wish I knew how to resolve it. 

In reply to Sakshi Goel

Re: Messaging: HTML code in emails from messaging...

by Dr. Nellie Deutsch -

That didn't resolve it for me, but I did resolve it by changing the mail in messaging to text/no html by default and changed Newline characters used in mail messages to CRLF. I also added noreply instead of the sender's email as default from the discussion forum.

Use email address in replyforum_replytouser
Default: Yes 

When a forum post is mailed out, should it contain the user's email address so that recipients can reply personally rather than via the forum? Even if set to 'Yes' users can choose in their profile to keep their email address secret.

I unticked the box.

Finally,  I purged all caches. 

The email notifications are being sent properly now.