Email bouncing due to FromName???

Email bouncing due to FromName???

by Shane Drower-Copley -
Number of replies: 4

Hi all,

Using Moodle 3.1.1

Our hosting provider recently implemented some changes to their spam filtering system and as a result it seems some of our automatic notifications are now failing to be delivered.

Specifically I have experienced the problem in relation to submission notifications - ie when a student submits an assignment the email notification that should be sent to the teachers and managers of the course is being bounced.

Below is a snippet of the "mail delivery failed" email. I have changed names to generic, First and Last stand for the first and last name of the sender and name@domain.co.za is currently my site's noreply address:


SMTP error from remote mail server after MAIL FROM:<"First Last" <name@domain.co.za>> SIZE=3353:

    host 127.0.0.1 [127.0.0.1]: 501 <"First  Last" <name@domain.co.za>>:

    "@" or "." expected after ""First Last""


I have contacted our hosting provider and they have informed me that it is as simple as it seems above. Their spam filter expects to see an "@" or a "." after the first name found in the FROM field of the header. I have been told that their is no way to white-list my domain or alter the method of  spam filtering and that I need to change the code that generates the headers in my emails to remove the First Last section of the FROM header.

I have searched high and low for how I can edit the From Name out of the notification emails, however I cannot find an explanation.

I have found the $mail->FromName variable in the email_to_user function in the moodlelib.php file, however I am sure that simply removing things in here would cause problems as other parts of moodle call this function and will not get the variables required. Rather I wish there were a way to remove it from moodle's equivalent to a "template" in the "Model-Controller-View" architecture (one I am more acquainted with). This way the functions could assign the FromName variable however it would  simply never be displayed.

I have read a bit about renderers in moodle however I am not sure how they work.

Does anyone have any ideas?

Kind regards
Shane
 


Average of ratings: -
In reply to Shane Drower-Copley

Re: Email bouncing due to FromName???

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
The additional pair of brackets could be the problem. An e-mail address is "First Last" <name@domain.co.za> and not <"First Last" <name@domain.co.za>>.
In reply to Visvanath Ratnaweera

Re: Email bouncing due to FromName???

by Shane Drower-Copley -

Thanks Visvanath,

Any idea on how I can change how moodle generates the email headers, perhaps then I could remove the second set of brackets?


Kind regards

Shane

In reply to Shane Drower-Copley

Re: Email bouncing due to FromName???

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Look where you've configurated it (through the web interface). For example Site administration > Plugins > Message outputs > Email > No-reply address.

In reply to Visvanath Ratnaweera

Re: Email bouncing due to FromName???

by Shane Drower-Copley -

Thanks again Visvanath,

I have had a look at the No-Reply address however all I have in there is a email address, I have not put in extra brackets so I'm not sure where the extra brackets are coming from.


That being said the issue seems to have resolved itself in fact. This morning I tried submitting some test assessments and they notifications went through as they should. Perhaps there was a temporary problem with our hosting provider.

Thanks for the quick feedback.

Kind regards

Shane