Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -
Number of replies: 11

Hi,

I just upgraded Moodle to 3.3.4, but email notification was not sent. Since we are using a SMTP server without authentication, I disabled SMTP Authentication in moodle_phpmailer.php and set smtpauthtype” value to NULL in mdl.config SQL table

moodle_phpmailer.php

mdl_config table 

However, I still got the error message when I tried to register a new account.

error message

I really have no idea how to handle this issue. Hope someone can help me to solve it. Thanks in advance!

Schwann


Average of ratings: -
In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -
In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Matteo Scaramuccia -

Hi Schwann,
what was your previous Moodle version?

There's no reason to make changes to the code but disabling the authentication when (re)configuring the SMTP settings by removing the SMTP user (and password).

Besides, do not change anything from the database directly since some data could be cached i.e. not reloaded from the database until you'll purge the Moodle caches.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -

Hi Matteo,

The previous Moodle version is 3.1.2. But I don't think the email notification issue dues to the Moodle upgrade, we also migrated our SMTP Server to a new one. And the new SMTP server doesn't require authentication. So I disabled the SMTP Authentication in moodle_phpmailer.php. Otherwise the default authentication type is "LOGIN" as below:

SMTP auth type

I also cleared the SMTP username and password, but the error still existed.

Schwann

In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Ken Task -
Picture of Particularly helpful Moodlers

+1 to what Matteo has already said ... but now a question ...

something not mentioned before the response above ... 'we also migrated SMTP server to a new one' ...    Hmmmm things worked before, and now they don't ... but ... both servers have undergone upgrades, etc. as well as moves?

and from what you've described about the new SMTP server it allows any/all mail to be relayed through it without any authentication ... what could be called an open relay.

I do hope, if that is the case, that the Moodle and the SMTP are internal to a private network.

So is the Moodle server on linux?   If so, install a text based MTA ... like 'alpine' ... configure it to use the SMTP server with no credentials ... and see if you can send mail from the root user of the moodle server via alpine to yourself @ whereever.

Assuming Linux again ... think any flavor ... is there a maillog file in /var/logs/ or whereever your Linux flavor stores logs?

'spirit of sharing', Ken



In reply to Ken Task

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -

Hi Ken,

Yes, we have upgraded our SMTP server. And the email notification could not be sent since the upgrading.

The Moodle server is on Windows Server 2012. The Logs is stored in SQL database:

Logs


debug info

debug

Schwann

In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -

And before I configured the SMTP settings on Moodle, just left the SMTP hosts, SMTP username, SMTP password empty (use the PHP default method to send email), and registered a new account, the notification email was still not sent.

Schwann

In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Matteo Scaramuccia -

Hi Schwann,
could you install https://moodle.org/plugins/local_mailtest?
It could test the SMTP connection in an easy way w/ almost the same output but w/o the need to activate SMTP debugging, just to have the plain SMTP conversation, easier to cut&paste the text.

Please, restore the original Moodle code and purge all caches before trying to test the connection: we need to investigate why Moodle is attempting to authenticate when your SMTP server is not announcing any authentication mechanism, being sure that the configuration is as plain as you've described i.e. only an SMTP host in Site administration > Server > Email > Outgoing mail configuration.

Some recent refs:

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -

Hi Matteo,

I am appreciated for your reply. According to your advice, I re-configured the SMTP setting on Moodle server, and purged all caches. This time SMTP connection is successful, but I didn't receive the notification email.

I received a success message after doing the eMail test on Moodle server:

success message1

success message

I also got a success message after registration:

success message2

Mail tracking logs:

Logs

The log entry

stat=Sent ( <remote-id> Queued mail for delivery)

indicates that the remote server accepted the message. From the perspective of your SMTP server is has been delivered. It is now in the next hop towards the recipients INBOX.

Typically, the message will move through SPAM and anti-virus filters etc. before ending up either in the recipient's INBOX, Spam folder or possibly silently discarded.

However, there was no notification email in those folders. I registered 3 accounts with 3 different emails, none of them had the notification email (neither in INBOX, nor in spam folder). 

Schwann


In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Ken Task -
Picture of Particularly helpful Moodlers

Is there an MTA client of some sort on a Windoze box?   Don't think there is ... thus no way to setup a 'smart host' and the only way you have to send from Moodle is the php scripts provided with Moodle code.

In your image screen shot of EMail debugging, look at the 7th line up from the bottom.

What does it say?

'error could not authenticate' ...

Now am a Linux person myself, but that would seem to indicate that the SMTP server isn't an open relay and does require some sort of authentication.

So all in all, looks like Moodle is packaging a message up, then tries to send a message, moodle server and the php script is talking to the SMTP server,  but SMTP server isn't accepting.

Just for grins ... on the SMTP server setup a user ... 'moodle' ... password 'moodle' ... and in Moodle config setup the SMTP server ... IP address of SMTP server.   Is it a 10. (?) or is the SMTP server outside of the 10. private IP network? user moodle password moodle.

Might need to force the running of your cron job by now.

Matteo ... what say you?

'spirit of sharing', Ken

In reply to Ken Task

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Schwann Chan -

Hi Ken,

I think Matteo is correct. My SMTP server doesn't require authentication. I re-configured the SMTP settings on my Moodle server and purged all the caches. SMTP connection is successful now. I get a new issue: No notification email is received after registration.

success message

Logs

Mail tracking logs show the action as "Queued mail for delivery". I registered 3 accounts with outlook, and gmail, but none of them got the message. I checked the spam folders, but not found there. 

Schwann

In reply to Schwann Chan

Re: Tried to send you an email but failed (Moodle 3.3.4+Eguru Theme)

by Ken Task -
Picture of Particularly helpful Moodlers

In troubleshooting mail, always follow the path.   So it appears now that the mail is being sent successfully to the SMTP server but not arriving at outlook.com.   You don't control ouitlook.com.  So check your SMTP server logs ... if you don't admin that server, collaborate with the SMTP server admin and ask them to check logs.

BTW, it is a risk to have any internal mail server ... even if 10. ... to allow relay of Mail (open relay) without either a whitelisted IP address (trusted machine that has antivirus), credentials check, etc.

'spirit of sharing', Ken