There is a server on the ubuntu system on which nginx is installed. It is necessary that when registering, an email is sent to the mail that was registered, I use the mail () function. In php, but the message cannot be understood. Everything works on the local host

<?php $email = $_POST['to']; $from = "a@gmail.com"; $subject = "fsfs"; $body = "this is auto message"; $from_new = "from: $from"; mail($email,$subject,$body,$from_new); ?> 

introduced this command

 <?php echo mail ("my_exist@gmail.com","test message", "test message","From:no-reply@gmail.com"); ?> выдает 1 что это значит и как все таки настроить чтоб сообщение отправлялось. Заранее спасибо за ответы 
  • $ _POST ['to'] is correct (try different? Sendmail costs? Server restarted by sending sendmail? What if you remove the last parameter? Sendmail also has a log ... - Rou1997
  • @ Rou1997 sendmail delivered but it may need to be somehow corrected, and if you remove the last parameter, then from where the message will be sent - Sergey
  • if it doesn't work, then at least where it went from, this should be the principle - Rou1997
  • @ Rou1997 removed the last parameter is also not working (( - Sergey

2 answers 2

Try to check for your IP in spam databases here . Maybe you are lucky and your IP got there. Because of this, emails may not arrive, as email systems will regard them as spam.

  • thanks checked but everything is fine the question remains open (((you do not accidentally know how to properly configure sendmail, I still sin on it - Sergey
  • I added something please see if it can help you to understand my problem - Sergey
  • @Sergey, 1 = TRUE. So the letter is supposed to be sent. This does not mean that it was received. If sendmail worked incorrectly, then it most likely gave out 0 (FALSE). I’m sure there is a message validation on the Google Mail server. I very much doubt here: "From: no-reply@gmail.com". Google does not work fools. Sending from non-existent mail looks very suspicious. Try to repeat this experiment using existing emails. - user263096
  • I tried to no avail - Sergey
  • Messages for some reason are not sent and go to the deferred - Sergey

The problem was with sendmail. Removed sendmail () put postfix everything worked as it should have been !!!!