So you have cron working on your Moodle site but you have the annoying problem of emails from your site being marked as spam or not getting delivered at all to some email domains. For example, they might be delivered to a Gmail address (even if they’re going to the spam folder) but not to an institutional email address.
If you see an email from your Moodle site marked as spam, download the email with full headers (in Gmail, you can do this through the “Show original” option) and check if there is a “fail” message next to SPF, DKIM or DMARC. This is a sign that something is wrong.
For example, if you see a “fail” or “softfail” message for SPF, the SPF DNS entry for your Moodle site may not be up-to-date. I encountered this problem recently after a Moodle site I administer was upgraded and it resulted in a change in the IP address as well as a transition from IPv4 to IPv6.
It could also be that the IP address of your Moodle site has somehow been blacklisted. There are lots of email blacklists but only some of the blacklists influence email delivery to major providers such as Gmail and Yahoo.
None of the above – SPF, DKIM, DMARC, IP blacklisting – are Moodle-specific issues but they can affect your Moodle site, so you will need to consult a system administrator who has overall responsibility for the IT systems at your institution.
Image source: Uptake Digital (Brenton Johnson)
See also this post from UptakeDigital Brenton Johnson: https://uptakedigital.zendesk.com/hc/en-us/articles/115000229034-SPF-DKIM-DMARC-Technical-Details