Issue Details (XML | Word | Printable)

Key: MDL-8476
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Petr Skoda
Reporter: Thomas Robb
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Administration/Server/Email setting "Allow users to select character set" causes send() to die

Created: 10/Feb/07 01:18 PM   Updated: 13/Dec/07 10:58 PM
Return to search
Component/s: Lib
Affects Version/s: 1.7.1
Fix Version/s: 1.7.2, 1.8

Participants: Martin Dougiamas, Petr Skoda, Robert Brenstein and Thomas Robb
Security Level: None
Resolved date: 23/Mar/07
Affected Branches: MOODLE_17_STABLE
Fixed Branches: MOODLE_17_STABLE, MOODLE_18_STABLE


 Description  « Hide
For a week I have been having back-and-forths with my ISP support staff about why messages on a new Moodle 1.7,1+ installation was not sending out messages. Cron was working properly and messages in the database were getting tagged with a "1" for "sent" although nothing ever went out and no error messages were generated. It turns out that they were dying when $mail->Send() was invoked in moodlelib.php (around line 3424).

Looking at the $mail object, I discovered that the [Body],[FromName] and [Subject] were blank even though the correct values were there when checked with debugging output higher up in the email_to_user function. It turns out that the section just above if ($mail-.Send()) that starts with the code below was returning NULL for these values.

  /// If we are running under Unicode and sitemailcharset or allowusermailcharset are set, convert the email
  /// encoding to the specified one
      if (!empty($CFG->unicodedb) && (!empty($CFG->sitemailcharset) || !empty($CFG->allowusermailcharset))) {

The site is set to use Unicode.


 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas added a comment - 13/Feb/07 12:23 PM
In 1.8 this line appears to have been changed to:

if ((!empty($CFG->sitemailcharset) || !empty($CFG->allowusermailcharset))) {

Can you confirm that this fixes your problem in 1.7?


Thomas Robb added a comment - 13/Feb/07 07:30 PM

>Martin Dougiamas [13/Feb/07 12:23 PM]
>In 1.8 this line appears to have been changed to:
>
> if ((!empty($CFG->sitemailcharset) || !empty($CFG->allowusermailcharset))) {
>
>Can you confirm that this fixes your problem in 1.7?

No, it doesn't. I substituted the above line for the one you see commented out below, placed a check mark in the "allowusermailcharset" setting in the administrative settings/server/email panel, and then attempted to send two emails, one the normal way, and another with "immediate send". Neither message was send out but the messages are now labelled "sent" in the database.

if ((!empty($CFG->sitemailcharset) || !empty($CFG->allowusermailcharset))) {
// if (!empty($CFG->allowusermailcharset)) {

When I removed the check mark and attempted to send out another message, it went out as expected.

I'm not sure if this is related to this bug or not, but as adminstrator or when I log on with a user who is a teacher of the course, all of the messages, when pulled up, have a "edit" link at the bottom in addition to "delete" and "reply" even though the messages have been sent out. I have not explicity allowed the admin to edit all messages in the config file.


Petr Skoda added a comment - 23/Mar/07 07:32 AM
This problem was most probably caused by infinite loop during conversion to gb18030 encoding, should be fixed in cvs

thanks for the report!


Robert Brenstein added a comment - 13/Dec/07 10:56 PM - edited
sorry, can't delete wrongly placed comment