I will use this code for sending simple mail. But the time of execution the condition will be false..(else part)

    $fname=$_POST['form_name'];
    $email=$_POST['form_email'];
    $phone=$_POST['form_phone'];
    $subject=$_POST['form_subject'];
    $remarks=$_POST['form_message'];


   $message = "Hi you have a new Enquiry"."\r\n". "See Details below". "\r\n" . "Name :".$fname." "."\n". "Email :".$email. "\n"."Contact Number : ".$phone."\n"."Subject Number : ".$subject."\n"."remarks :".$remarks."\n";



        $subject='test message ' .$email;
        $message=$message;
        $headers= 'From: [email protected]' . "\r\n" .'Reply-To: [email protected]' . "\r\n" .'X-Mailer: PHP/' . phpversion();
        $headers.= 'MIME-Version: 1.0' . "\r\n";



          if(mail("[email protected]",$subject,$message,$headers)) {
             echo '<div class="text-center"> <p class="success" style="color: #d1287a; font-size: 26px;
            padding-top: 30px;">Thank you for  Registering  with us, We will Contact you Soon!   </p></div>';

        } else {
            echo 'Error while sending mail,Please try again later';
        }
 }

0 Answers