-
Improvement
-
Resolution: Deferred
-
Minor
-
None
-
3.10.4, 3.11
-
None
-
MOODLE_310_STABLE, MOODLE_311_STABLE
We like the feature to be able to respond to forum posts via email. Moodle generates a special mail adress with a token that encodes the information how to handle the mail:
$mailaddress = $postbox . "+" . $subaddress . "@" . $domain;
The subaddress is base64 encoded data. Base64 contains alphanumeric characters and "+" and "/" and "=".
Some broken clients or, like in our case, mail servers, have problems with those special characters in the generated subaddresses (especially a second "+" will break the email delivery to the postbox).
I know it's not a problem in moodle but it could make life easier and there is a simple fix: Simply remove "=" at the end (its only purpose is padding and no data is lost when it is missing) and replace "+" and "/" by some more common characters like "-" and ".".
Fix:
File: lib/classes/message/inbuond/address_manager.php
line 268 (function generate): replace
$subaddress = base64_encode(implode($data));
by
$subaddress = str_replace('=', '', strtr(base64_encode(implode($data)), '+/', '-_'));
line 306 (function process): replace
$data = base64_decode($encodeddata, true);
by
$data = base64_decode(strtr($encodeddata, '-_', '+/'), true);
Note that old addresses will still continue to work after the fix.
I hope this fix will find its way into the officiall moodle distribution.
Henrik