Upgraded to Moodle 3.4.1+ and gmail stopped working

Upgraded to Moodle 3.4.1+ and gmail stopped working

by Ryan B -
Number of replies: 7
I upgraded my server running Ubuntu 16.04.4 LTS from Moodle 3.3 to 3.4.1+ a few weeks ago before the start of the semester. All seemed to be working fine, but now I'm noticing that the server is no longer sending out email. Students who are registered are creating accounts, and the accounts are being created, but they are then greeted by a message, "Tried to send you an email but failed!". Other emails for announcements and notices also are not going out.

Logged into the server and tried pinging smtp.gmail.com - No problems, pings fine.
Tried pinging smtp.gmail.com:465 - packets sent, but none received. Same with smtp.gmail.com:587.

I've heard something about GMail finding Moodle to be insecure recently? Is that the issue? I've checked that "Allow less secure apps" is on, and it is. Is there anything else I can do?

For now I've been manually confirming accounts, but the inability to send out grades, announcements, notices, and other emails is not great.  Is there any way that I can fix this, or are there other alternatives? Running my own mail server isn't an option as my school network will not allow it.

Thanks in advance for any insight or help provided!


Average of ratings: -
In reply to Ryan B

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Ryan,
try to use the Moodle mail tester and copy&paste here its trace (anonymizing what sensitive there for you e.g. the name of the host): https://moodle.org/plugins/local_mailtest

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Ryan B -

I sent a message from a valid email address, and got the following:

2018-03-08 22:20:53	Invalid address:  (addAnAddress Reply-To): noreply@[ServerIP]
2018-03-08 22:20:53	Invalid address:  (punyEncode) noreply@[ServerIP]
I then changed the no-reply address to a valid address and tried to send another email. I got the following:

2018-03-08 22:23:57	Invalid address:  (punyEncode) mdlAABnf///w==848bb3cbe1c54ec0a94310f01d4ea9bd@bounces.[ServerIP]
In both cases, it failed to send an email. I'm not sure what is up with the second address, as that is nowhere in my configuration.

Any ideas?

In reply to Ryan B

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Ryan,
apologize but I do not understand your tests: how did you send those two message and where did you read the error?
Have you enabled the SMTP debugging via https://docs.moodle.org/34/en/Debugging#Debug_email_sending?

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Ryan B -

I sent those Emails from the Moodle Email Tester plugin that you linked. I installed the plugin and tried to send an email with it. Those error messages are what came back = the output of the email test plugin.

I've turned on email debugging. I get the same message during the tests.

In reply to Matteo Scaramuccia

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Dimitar Bogatinov -

What about this problem 

2018-10-24 21:11:17	Invalid address:  (punyEncode) noreply@164.40.250.162

In reply to Dimitar Bogatinov

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Daniel Tamajon -

Hi! 

Have someone done any advance on solving this situtation?

My context is Moodle 3.6.2, running on nginx with PHP7.2, on a Debian 8 server.

I have different moodle sites on the same machine and all them can send mails using SMTP, except one which is giving me the "Invalid address:  (punyEncode)" message using the mailtest plugin.

I have tested SMTP parameters on a email client and its working properly.


Any help is welcome.

Thank you!

In reply to Daniel Tamajon

Re: Upgraded to Moodle 3.4.1+ and gmail stopped working

by Daniel Tamajon -

Hi!

I have found the problem was the variable maildomain was not defined, so you must define it on the config.php:

// Domain which acccepts email for processing
$CFG->maildomain = 'mydomain.com';