Some users have characters in their first- and lastnames of their Moodle-Account that are marked as "special characters" in RFC2822. These characters are:
( ) < > [ ] : ; @ \ , .
Example: If someone has used "Mustermann [AdAcc]" as last name in Moodle (just to show up that this account has a special meaning) or their is a middlename with a DOT like "Hans J. Mustermann" the PHPmailer in Moodle generates a "From:"-Header in the mail of a forum that looks like this:
From: Hans Mustermann [AdAcc] <mustermann@gmx.de>
From: Hans J. Mustermann <mustermann@gmx.de>
But since [, ] or the dot are special characters they must be quoted to be conform to RFC2822. The correct header lines would be:
From: "Hans Mustermann [AdAcc]" <mustermann@gmx.de>
From: "Hans J. Mustermann" <mustermann@gmx.de>
With some providers (for example Freenet in Germany) this leads to a mail delivery problem because the Freenet-Mail-Exchanger refuses these headers and replies with a 550 error.
A quick and dirty hack (I am not a PHP programmer) is editing /lib/phpmailer/class.phpmailer.php. Changing the last line from
$from = array();
$from[0][0] = trim($this->From);
$from[0][1] = $this->FromName;
to
$from = array();
$from[0][0] = trim($this->From);
$from[0][1] = '"' . $this->FromName . '"';
is a quick solution. But perhaps someone can find a better way to do this.
Regards, Andreas
- has been marked as being related by
-
MDL-11645 emails are sent with user's email as sender, so are rejected as spam
-
- Closed
-