The problem: Emails aren't being sent out. In this specific case it was the forum software "MyBB" not sending registration emails to users.
The first thing to do is: Test if it actually sends the email.
For this I recommend using a non-gmail email like one from "temp-mail.org" or similar.
Simply copy and paste this PHP file to a browsable location in your web folder.
IMPORTANT: Change user@example.com to the email you want your server to send it from, for example noreply@yourdomain.net. Change me@hotmail.com to your own email address.
<?php error_reporting(-1); ini_set('display_errors', 'On'); set_error_handler("var_dump"); echo "Running: "; $headers = 'From: user@example.com' . "\r\n" . 'Reply-To: user@example.com'; $success = mail('me@hotmail.com', 'The papers for your report', "Hope you can use them! BR", $headers); if (!$success) { echo "ERROR: '"; $errorMessage = error_get_last()['message']; echo $errorMessage; echo "'"; }else{ echo " Successfull!"; } ?>If you now visit the website and it says "Running: Successfull!" then PHP mail is working fine.
If Emails are still not sending you can check the sendmail logs and mail spools.
To check if a mail was actually send you can use the following command:
sudo less /var/log/mail.logThis contains information from the journal which tells you if mails were accepted for delivery.
sudo less /var/spool/mail/www-dataIn here are emails you get back from successfully sending one with the php mail function.
Subject: Returned mail: see transcript for details Auto-Submitted: auto-generated (failure) This is a MIME-encapsulated message --X.X/vX.luckysrv.de The original message was received at Sat, 27 Feb 2021 23:25:34 +0100 from localhost [127.0.0.1] ----- The following addresses had permanent fatal errors ----- <userX@gmail.com> (reason: 550-5.7.1 [3b01:4000:4d:f7f:284a:1aff:febc:44D2] Our system has detected that) ----- Transcript of session follows ----- ... while talking to gmail-smtp-in.l.google.com.: >>> DATA <<< 550-5.7.1 [3b01:4000:4d:f7f:284a:1aff:febc:44D2] Our system has detected that <<< 550-5.7.1 this message does not meet IPv6 sending guidelines regarding PTR <<< 550-5.7.1 records and authentication. Please review <<< 550-5.7.1 https://support.google.com/mail/?p=IPv6AuthError for more information <<< 550 5.7.1 . m4si12345803wrp.16 - gsmtp 554 5.0.0 Service unavailableThis error message means the following: