0

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.

  1. I have unblocked my domain name at postmaster.mail.ru
  2. 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.
  3. When I input a mail.ru address in the form as receiver or sender, it does not arrive.
  4. It does not arrive in my personal mail.ru account when I use, for example, noreply@mydomain as a sender.
  5. Also, it does not arrive in my personal mail.ru account when I use mydomain.registration@mail.ru as a sender.
  6. 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>
kyle
  • 691
  • 1
  • 7
  • 17
VagebonT
  • 21
  • 5
  • 1
    Remember to read up on what kind of syntax Stackoverflow supports, and please edit your post so that people can comfortably read your code. – Mike 'Pomax' Kamermans Feb 15 '19 at 21:42
  • You don't provide any error information (observations, not interpretations!). You don't provide code as you claim. Also, you are asking why some other system behaves differently, so what would you think would make a correct answer to your question? Please read [ask]. Also, as a new user, take the [tour]! – Ulrich Eckhardt Feb 15 '19 at 22:04
  • I suggest you to check the spam folder :D – Vixed Feb 15 '19 at 22:15
  • Excuse me but there is no more error information to give. The emails do not arrive at mail.ru nor do they arrive when mail.ru is used as the sender. Nothing arrives and thus also no error reportings or messages. Nothing happens. The correct answer to my question could be something like telling me what i do not know to make mail.ru work just as all other email providers do work using mail() – VagebonT Feb 15 '19 at 22:32
  • i can fill in whatever as sender in my form. Even like santaklaus@eastereggs.com and it will arrive as sended from santaklaus@eastereggs.com... but not with using whatever@mail.ru and nothing arrives as well when whatever is sended to whatever@mail.ru – VagebonT Feb 15 '19 at 22:36
  • 2
    You're spoofing the sender, mail.ru may have measures to stop you from doing that, such as DMARC or SPF. – Lee Kowalkowski Feb 15 '19 at 22:40
  • When i use santaklaus@eastereggs.com i indeed might spoof some sender. But not when i am using whatever@mydomain.com or when i use an email i have registered at mail.ru myself. As for example mydomain.registration@mail.ru. However thank you for providing me some insight. I was already thinking it might have something to do whit the info in the header of rather the lack thereoff. – VagebonT Feb 15 '19 at 23:01
  • See the reference on why fake `From:` headers are hit and miss. – mario Feb 15 '19 at 23:42

1 Answers1

0

This is not really PHP related, as such.

You don't have very many email headers, for example, my hosting company uses DKIM to add a digital signature to all its outgoing email, which requires me to add a date header to my outgoing email for DKIM to work as intended.

If you can send email to some addresses, then use a deliverability checker like the one at https://mxtoolbox.com/deliverability for an analysis of your outgoing mail setup.

It's probably scoring very highly as spam.

Lee Kowalkowski
  • 11,591
  • 3
  • 40
  • 46