Not getting forum e-mail notifications

Not getting forum e-mail notifications

by Juan Becette -
Number of replies: 3

Greetings, first time poster here. Hope someone can help me with this issue.

I have a problem when sending forum e-mail notifications. I've been testing them with a hotmail account and a gmail account. The hotmail account gets them in the spam folder, with a warning ("this message appears to be a phishing scam"); the gmail account never gets them (my guess is that it's rejecting the messages).

Mail configuration seems to be ok (I get test e-mails, password change requests, etc), and cron seems to be running correctly. Also, I'm using Google's SMTP Server (site is configured with a Google Workspace account). Moodle version is 3.9.1. 

I tried changing the "mailnewline" property to CRLF (as I read it could be a cause of not getting emails), but the result is the same.

What could be causing this issue? Any insight will be appreciated, thanks in advance!

Average of ratings: -
In reply to Juan Becette

Re: Not getting forum e-mail notifications

by Ken Task -
Picture of Particularly helpful Moodlers

Consider this response as 'insight' (kinda) as a former mail server(s) [note that's plural]  and mail gateway(s) admin ... which in itself was a full time job which my employer [at the time] did not consider to be 'full time' - just 'another hat' under 'internet'.

Using SMTP relay for anything, let alone moodle, is more complicated than moodle docs/config and the other end (the smtp server doing the relay) leads you to believe.

The following links might help ... and they are technical ... can't avoid that.   So with that in mind:

Please see:
https://support.google.com/a/answer/2618874?hl=en

https://support.google.com/a/answer/6140680?hl=en#zippy=

also
https://support.google.com/a/answer/2956491?hl=en&ref_topic=2921034

also
https://support.google.com/a/answer/178333?hl=en&ref_topic=2921034

Personally, have found using Sendgrid's API smtp relay to be the 'easiest' and most reliable with reservation as to volume of forum mail.   Note: there will be differences of opinion using Postfix below.

smarthost for Postfix installed on same server as the Moodle as local only (sending only)
https://support.google.com/a/answer/2956491?hl=en&ref_topic=2921034#zippy=%2Cpostfix

https://sendgrid.com/docs/for-developers/sending-email/api-getting-started/

With google, do you have Google Oauth2 config'd in your Moodle?  How about Google Drive/Docs?

The requirements to get those to work carry over to Google as SMTP relay.

Now if you host on shared hosting ... you can forget all above.  If you are on a self-managed VPS and have ability to sudo to root + are not adverse to command line, then there's a greater chance you will succeed in getting this fixed and working.

One thing you should probably do is to attempt to find out just how much forums and anything in your Moodle would use email notifications.   There is no admin report for that.

Why?  Volume of messages = cost.  Many (if not all) SMTP relay offered as a service does have a cap at the free level and going over that cap will involve a fee.

'Spirit of Sharing' (SoS), Ken

In reply to Juan Becette

Re: Not getting forum e-mail notifications

by Matt T -
I'm not a big fan of Moodle notification emails. They are styled and structured in a way that makes them apt to trigger spam filters. In that respect there's not a lot you can do, other than to bolster your email reputation through other means.

I would suggest using a proper transactional email platform, rather than Google's SMTP Server. Ken has mentioned Sendgrid above. I use Amazon Simple Email Service (SES). Mailchimp/Mailgun are other examples.

These providers put in additional 'checks' on who is allowed to send email on their platform, and what they are allowed to send. They promptly disable the accounts of spammers. They enforce daily sending limits. They have feedback mechanisms which detect when people mark messages as spam, and will limit the sender's capabilities accordingly. Therefore, they tend to have a better reputation, especially with the 'top gun' email services such as Gmail/Google Workspace and Outlook.com/Office 365. They are significantly less likely to trigger spam filters than a run-of-the-mill SMTP server.

On top of this, there's a few other things you can do.

1. Setup SPF, DKIM and DMARC records on your domain. If you use one of the transactional email services listed above, they will have guides on how to do this. This will improve sender reputation.
2. Ensure your domain itself is reliable - don't send junk emails from your own domain. Send marketing emails from another domain, or even better, don't send them at all.
3. Make sure Moodle is configured to only send emails from your own domain, and not to purport to send emails on behalf of other email addresses you do not own. Transactional email services will block an attempt to do so.
4. Make sure your Moodle website uses HTTPS, as opposed to HTTP, so that the links in the email go to a HTTPS website.
Average of ratings: Useful (1)