0
<?php

ini_set('display_errors', '1');
include '../application/includes/config.php';


$mailto=$_POST['email'];
$subject="Information";
$message_body="Welcome to the digital world!";
$from="info@mydomain.com";


$mail = mail($mailto,$subject,$message_body,"From:".$from);

if($mail){
  echo "Thank you for using our mail form";
}else{
  echo "Mail sending failed."; 
}
?>

I have tested this code on other website. It's working there but on my server it only displays "Mail sending failed" error..

  • in your else condition, add `print_r(error_get_last());` – Rotimi May 03 '18 at 12:32
  • 1
    this is using a config.php file in the folder specified... make sure you have a correct config.php with all the correct information about the server and make sure it is located in a reachable folder. – Gerasimos Ragavanis May 03 '18 at 12:32

0 Answers0