If you want to check why the email was not delivered, you can usually go to the “Delivery Tracking” section in the cPanel. In addition, if the email is not delivered, the sender receives a letter specifying the reason for its failure to deliver.
If emails go to spam, first check if the sender’s values are set correctly in the send script. For your emails to successfully pass spam filters, specify email in the same domain as the website. Records confirming the authenticity of the sender have a positive impact on passing spam filters: DKIM, SPF, DMARC.
DKIM and SPF records can be set under the “Authentication” section. DMARC records must be specified manually in the “Advanced Zone Editor” section. You will need to create a TXT entry for the _dmarc subdomain. TTL value may be specified as 660. Sample records can be viewed in this article.
Records will take effect within half an hour after configuration. Sending emails via SMTP with authorization, instead of the usual sending with the mail feature, may also have a positive effect on passing spam filters.