To send the simplest message, is it enough to use the mail() function? But for some reason this function returns false me when checking. What could be the problem?

 mail('gribkovartem@gmail.com', 'Test', 'testtesttest'); 
  • Perhaps sendmail is not configured on your server. - Shevsky
  • Do not leave the feeling that the sending you are trying to do on the local server, and catch the letter - in the internet. - Deonis

3 answers 3

Example function:

  mail($to, $tema, $text, $header); 

Where $to - to whom, $tema - theme, $text - text, $header - headers

Sample Headers

 $email_header = "MIME-Version: 1.0 \r\n"; $email_header .= "Content-type: text/html; charset=utf-8 \r\n"; $email_header .= "From: ".$_SERVER['HTTP_HOST']." <admin@".$_SERVER['HTTP_HOST'].">\r\n"; 

Try adding headlines, maybe this will help.

    Like that. In regulation:

     mail($to, 'Подтверждение регистрации на сайте site.com ', "Подтвердите ваш аккаунт, нажав на <a href=\"http://site.com/confirm.php?email={$to}\">эту ссылку</a>"); 

    confirm.php:

     $password = 'password'; // генерируем пароль mysql_query("UPDATE `users` SET `confirmed` = 1, `password` = '{$password}' WHERE `email` = '{$_GET[email]}'"); mail($_GET['email'], 'Ваши регистрационные данные от site.com ', "Ваш пароль: {$password}"); 

      Try using sendmail.