MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/public_html/imenso.co/ui/landing-powerbi/quote_mail.php
<?php
 ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
session_start();
?>

<?php 

    $to_email = "jparihar@imensosoftware.com";         
    $name = $_POST["name"];
    $phone_number = $_POST["phone"];
    $from = $_POST["email"];
    $message = $_POST["message"];
      
    $secure_check = sanitize_my_email($from);        
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
       
      // Create email headers
    $headers .= 'From: '.$name."<".$from.">\r\n".
    // $headers .= 'From: '.$name.'<'.$from.'>\r\n'. 
          'Reply-To: '.$from."\r\n" .
          'X-Mailer: PHP/' . phpversion();
       
    // Compose a simple HTML email message
    $txt_message = '<html><body>';
    $txt_message .= '<p style="color:#000;font-size:14px;">Name: '.$name.'</p>';
   
    if($phone_number!=""){
        $txt_message .= ' <p style="color:#000;font-size:14px;">Phone: '.$phone_number.'</p>';    
    }
    $txt_message .= '<p style="color:#000;font-size:14px;">Email: '.$from.'</p>';
    $txt_message .= '<p style="color:#000;font-size:14px;">Message: '.$message.'</p>';
    
    
    $txt_message .= '</body></html>';
    $subject = "Request a Quote";

    $error_msg="";
    if ($secure_check == false) {
      $error_msg = "Email address is invalid.";
      echo json_encode(['status'=>404, 'msg'=>$error_msg]);
    }
    else{
      $msg = "Email send successfully.";
      mail($to_email, $subject, $txt_message, $headers);

      echo json_encode(['status'=>200, 'msg'=>$msg]);
      exit;
    }
      function sanitize_my_email($field) {
          $field = filter_var($field, FILTER_SANITIZE_EMAIL);
          if (filter_var($field, FILTER_VALIDATE_EMAIL)) {
              return true;
          } else {
              return false;
          }
      }
?>