Issue with Email Notifications

Issue with Email Notifications

ADENIRAN O. MICHAEL發表於
Number of replies: 10

Hi All,

I am having issues as emails notification as it stopped going out for all:

Your site couldn't communicate with your mail server. Please check your outgoing mail configuration.

Email notifications was working fine previously, only noticed this when a few users said they are unable t reset password or send report via mail

image.png

image%20%281%29.png

評比平均分數: -
In reply to ADENIRAN O. MICHAEL

Re: Issue with Email Notifications

ADENIRAN O. MICHAEL發表於
Any help?
In reply to ADENIRAN O. MICHAEL

Re: Issue with Email Notifications

Eric Phetteplace發表於
Particularly helpful Moodlers的相片
You have no email server defined according to this screenshot, there should at least be an "SMTP host" listed but probably also a username and password. See the docs for configuring outgoing mail. If you do not have an SMTP server available, Moodle will not be able to send mail.
 
If you used to be able to send mail, you might want to see if you can determine how the settings changed. There is no way that mail could be delivered with the settings shown in this screenshot. Did you make an admin preset of your settings recently? I would consult that, if available.
In reply to Eric Phetteplace

Re: Issue with Email Notifications

ADENIRAN O. MICHAEL發表於
THanks for your feedback Eric!

I have been away treating myself.

With respect to SMTP host, I have made use of both Google and Outlook, and I noticed when I add any of the two, the whole LMS won't load for minutes/hours until I remove the values added to the settings.

What will you recommend?
In reply to ADENIRAN O. MICHAEL

Re: Issue with Email Notifications

Eric Phetteplace發表於
Particularly helpful Moodlers的相片
That seems like a different problem. If you remove your email settings, your site will not be able to email anymore.

You could look into setting up a different SMTP server. We use Mailgun. You can also run your own SMTP server. Gmail should work OK but there's an emails per day limit. Make sure you have the correct settings. For instance, you might want to increase the SMTP session limit to see if that improves performance. Also, you may want to increase the compute resources available to your site if it is locking up when trying to send mail. If it's possible to allocate more memory or CPU that might help. You can also reach out to your mail provider themselves to ask why using their service slows down Moodle.
In reply to Eric Phetteplace

Re: Issue with Email Notifications

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
Hello Eric
 
You wrote:
> If you remove your email settings, your site will not be able to email anymore.
 
That is unfortunately wrong. It is an old oddity in Moodle: No SMTP host means Moodle will try "localhost:25", the server where Moodle is running. So, if its port 25 serves SMTP and configured to send mails out, Moodle mail notifications will be sent.
In reply to ADENIRAN O. MICHAEL

Re: Issue with Email Notifications

Ken Task發表於
Particularly helpful Moodlers的相片
@ADENIRAN O. MICHAEL

Domain taken from your screen shot ... shows server is hosted with HOSTINGER.   Thus best to consult what hosting provider recommends.
 
Maybe these will help:
 
'SoS', Ken
評比平均分數:Useful (1)
In reply to ADENIRAN O. MICHAEL

Issue with Email Notifications

Jeff Rader發表於
Plugin developers的相片
I am having the same issue. It started with the update to 4.4.8.

Debugging from the Test Email gets me this:

2025-04-16 16:34:00 Connection: opening to smtp-relay.gmail.com:587, timeout=300, options=array()
2025-04-16 16:34:00 Connection: opened
2025-04-16 16:34:00 SERVER -> CLIENT: 220 smtp-relay.gmail.com ESMTP 8926c6da1cb9f-4f505cfb9ccsm765956173.9 - gsmtp
2025-04-16 16:34:00 CLIENT -> SERVER: EHLO www.sunsetonline.org
2025-04-16 16:34:00 SERVER -> CLIENT: 250-smtp-relay.gmail.com at your service, [192.249.120.208]
250-SIZE 157286400
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2025-04-16 16:34:00 CLIENT -> SERVER: STARTTLS
2025-04-16 16:34:00 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2025-04-16 16:34:00 CLIENT -> SERVER: EHLO www.sunsetonline.org
2025-04-16 16:34:00 SERVER -> CLIENT: 250-smtp-relay.gmail.com at your service, [192.249.120.208]
250-SIZE 157286400
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
2025-04-16 16:34:00 CLIENT -> SERVER: AUTH PLAIN
2025-04-16 16:34:01 SERVER -> CLIENT: 334
2025-04-16 16:34:01 CLIENT -> SERVER: [credentials hidden]
2025-04-16 16:34:02 SERVER -> CLIENT: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 8926c6da1cb9f-4f505cfb9ccsm765956173.9 - gsmtp
2025-04-16 16:34:02 SMTP ERROR: User & Password command failed: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8 https://support.google.com/mail/?p=BadCredentials 8926c6da1cb9f-4f505cfb9ccsm765956173.9 - gsmtp
2025-04-16 16:34:02 SMTP Error: Could not authenticate.

I've tried some other settings. Originally it was set for AUTH LOGIN. Same result.
In reply to Jeff Rader

Issue with Email Notifications

Eric Phetteplace發表於
Particularly helpful Moodlers的相片
That's actually very informative. I assume you have double-checked that your email and password in SMTP settings is correct?

It looks like Google has been progressively adding stricter requirements onto using Gmail as an SMTP server. I see here that as of March 14, 2025 SMTP will no longer work with basic authentication (e.g. a password): https://support.google.com/a/answer/14114704?hl=en You should be able to set up a Google OAuth service and then select that service under "OAuth 2 service" in the Outgoing Mail settings.

This article implies it's possible to use an application-specific password with Gmail's SMTP https://noted.lol/setup-gmail-smtp-sending-2023/ (says 2023 in the URL but 2025 in the post body) but I don't see how that could be true given the support page I linked above.
In reply to Jeff Rader

Issue with Email Notifications

Ken Task發表於
Particularly helpful Moodlers的相片

@Jeff ...

Used your moodle server's FQDN that was seen in above and ran a check with mxtoolbox.com.   It reported an issue About Dns Record Published.

"We did not find a DNS record published for this domain or hostname. DMARC is the key to improving Email Deliverability!"

Not enough to have MX records these days ... Google minimum is an SPF record but best if one has DKIM and DMARC as well.

Most DNS records are entered by a human.

DMARC is 'different' ... it's generated on the server itself and output of that is then entered into DNS records manually.

Moodle does have ability to gen a DMARC
https://docs.moodle.org/500/en/Mail_configuration
https://docs.moodle.org/500/en/Mail_configuration#DKIM

See your server is hosted with Inmotion Hosting.   Is it on a shared plan or a VPS/Dedicated?

From a Google search:

InMotion Hosting does not offer a relay setup for its shared hosting plans. If you're using a VPS or Dedicated plan, you might be able to configure a custom relay, but it would require specific settings and configurations, according to an InMotion Hosting support article. 

and a support article link:

https://www.inmotionhosting.com/support/questions/communities/1/topics/15671-how-can-i-set-an-email-relay-on-my-mail-server

'SoS', Ken

評比平均分數:Useful (1)