0

This is php mail code

            $to      = 'mymail@mail.com'; 
            $subject = 'the subject'; 
            $message = 'hello'; 
            $headers = 'From: raghu@digiverti.com' . "\r\n" . 
                'Reply-To: mymail@mail.com' . "\r\n" . 
                'X-Mailer: PHP/' . phpversion(); 

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

              echo "Not Sent";
              print_r(error_get_last()); 

            }

Please let me knowhow display actual error why mail not sending

  • I assume you have configured a mail server (SMTP) for sending mail with PHP? – xander Dec 08 '17 at 11:47
  • But i have commented code i am using normal php mail function – Raghu Darshan Dec 08 '17 at 11:47
  • Yes but to use the php `mail` function you have to configure a SMTP server, usually in the php.ini file. Here you can see more information: http://uk3.php.net/manual/en/mail.configuration.php (if you use a shared web hoster the mail server is usually pre configured) – xander Dec 08 '17 at 11:49
  • where i should find php.ini file in cpanel – Raghu Darshan Dec 08 '17 at 12:10

0 Answers0