On my website, users receive a verification email to confirm their email address after signing up. It works just fine with all email providers, except for mail.ru. Since I want to target a Russian public for my website, this is not so nice. I have written a simple script (see below) just to test whether emails get received or not.
- I have unblocked my domain name at postmaster.mail.ru
- I have made two mail.ru accounts. One personal and the other mydomain.registration@mail.ru. The last one just to see whether it would arrive using that one as the sender.
- When I input a mail.ru address in the form as receiver or sender, it does not arrive.
- It does not arrive in my personal mail.ru account when I use, for example, noreply@mydomain as a sender.
- Also, it does not arrive in my personal mail.ru account when I use mydomain.registration@mail.ru as a sender.
- Also when I use one of the mail.ru accounts and input them as sender and fill in my personal hotmail or yahoo email as a receiver it does not arrive.
if (isset($_POST['sendMail'])) {
$receiver = mysqli_real_escape_string($conn, $_POST['receiver']);
$sender = mysqli_real_escape_string($conn, $_POST['sender']);
$timeSent = date('Y-m-d / H:i:s');
$subject = 'mydomain.com - Emailtest';
$message = 'This is a testing Email from mydomain.com. The email was sent from '.$sender.' to '.$receiver.' at '.$timeSent.'';
$headers = 'From: '.$sender.'' . "\r\n" . 'Reply-To: ' .$sender. '' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($receiver, $subject, $message, $headers);
}
<form action="" method="POST">
<input type="email" name="receiver" placeholder="Receiver Email">
<input type="email" name="sender" placeholder="Sender Email">
<button type="submit" name="sendMail">Send</button>
</form>