I show you our solution. Currently, 99% of emails that are automatically sent from moodle are correctly received by users.
We are using a commercial smtp server (sendinblue). It's a service oriented to solve the problem that spam implies. I suppose that for other commercial SMTP servers the solution is similar.
I recommend following these steps:
1) Sign up for the service (sendinblue.com). Activate "transactional->smtp" section. On this server and on others you can try the service up to a limited number of emails (60).
2) Configure your moodle smtp:
- SMTP hosts: smtp-relay.sendinblue.com:587
- SMTP security: none
- SMTP Auth Type: LOGIN
- SMTP username: (this provided by your smtp service provider)
- SMTP password: (this provided by your smtp service provider)
No-reply address: (this account should exist, you check that this account has the SPF and DKIM records activated. It is highly recommended that the no-reply account be within the same domain as the moodle server).
3) Try it. You can check it by individual messages or by using https://moodle.org/plugins/local_mailtest
You can check the status of deliveries in the smtp service provider's detailed log.
Hope this helps!