Email is not sending

Hi

I’m using laravel and is working fine, but the mail component doesn’t works. Then I tried with php mail() function like this:

public function mailtest(){

  $from      = '[email protected]';

    $to      = '[email protected]';
  $subject = 'the subject';
  $message = 'hello';
  $headers = 'From: ' . $from . "\\r\

" .
'Reply-To: ’ . $from . "\r
" .
‘X-Mailer: PHP/’ . phpversion();

  if(mail($to, $subject, $message, $headers)){
    echo "sent";
  }else{
    echo "not sent";
  }

}

it excecutes well (shows ‘sent’ in the result view), but i never receive the mail.
I checked many discussions about, and tested many combinations, but still not working.
(I used real directions in the real code)

Any idea???

Aclaration: I can send and receive mails using the cpanel webmail, and it delivers well.

Tested using plain php without laravel and didn’t worked either

@pfiore said:
Hi

I’m using laravel and is working fine, but the mail component doesn’t works. Then I tried with php mail() function like this:

public function mailtest(){

  $from      = '[email protected]';

    $to      = '[email protected]';
  $subject = 'the subject';
  $message = 'hello';
  $headers = 'From: ' . $from . "\\r\

" .

      'Reply-To: ' . $from . "\\r\

" .

      'X-Mailer: PHP/' . phpversion();

  if(mail($to, $subject, $message, $headers)){
    echo "sent";
  }else{
    echo "not sent";
  }

}

it excecutes well (shows ‘sent’ in the result view), but i never receive the mail.
I checked many discussions about, and tested many combinations, but still not working.
(I used real directions in the real code)

Any idea???

https://infinityfree.net/support/php-mail/