Moodle

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

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.7.1
  • Fix Version/s: 1.7.2, 1.8
  • Component/s: Libraries
  • Labels:
    None
  • Affected Branches:
    MOODLE_17_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE

Description

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.

Activity

Hide
Martin Dougiamas added a comment -

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?

Show
Martin Dougiamas added a comment - 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?
Hide
Thomas Robb added a comment -

>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.

Show
Thomas Robb added a comment - >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.
Hide
Petr Škoda (skodak) added a comment -

This problem was most probably caused by infinite loop during conversion to gb18030 encoding, should be fixed in cvs

thanks for the report!

Show
Petr Škoda (skodak) added a comment - This problem was most probably caused by infinite loop during conversion to gb18030 encoding, should be fixed in cvs thanks for the report!
Hide
Robert Brenstein added a comment - - edited

sorry, can't delete wrongly placed comment

Show
Robert Brenstein added a comment - - edited sorry, can't delete wrongly placed comment

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: