<?php
	include('../db/connection.php');
   include('mail_configuration.php');
   
    //$main_org_mailid='info@b2lmobitech.in';
	$sanitized_emailid=stripcslashes($_POST['email']);
	$url_link=$_SERVER['SERVER_NAME'];
	$otp=$_POST['otp'];
    $email=$sanitized_emailid;
    $fittmail=$main_org_mailid;
    $to = "$email";
    //$otp = rand(1000,9999);
    $subject = 'mPragati: OTP for Secure Login';
    $headers = "From: " . strip_tags($fittmail) . "\r\n";
    $headers .= "Reply-To: ". strip_tags($fittmail) . "\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    // $url=$url_link."/Website/assets/img/proxpert_logo_f1.png";
    $url=$url_link."/CRF/dist/img/mPragati_Logo_V6.avif";
    
    $message = '<html><body style="background: #fff">';
    $message .= '<table style="width: 60%;margin: auto;">';
    $message .= "<tbody>";
    $message .= "<tr><td><img style='height:66px;text-align:left;margin-bottom:3%' src='$url'></td></tr>";
    $message .= "<tr><td><h2 style='text-align:left;font-size:30px;margin-top:0;margin-bottom:0'>OTP for Secure Login</h2></td></tr>";
    $message .= "<tr><td><p style='text-align:justify;font-size:18px;font-weight:500;margin-bottom:6%'>Please use the one time password (OTP) below for secure login into your mPragati account with email ID ".$email.".</p></td></tr>";
    $message .= "<tr><td><span style='background:lightgray;padding:4%;text-align:center;display:block;font-size:30px;font-weight:600;margin-bottom:5%'>". strip_tags($otp) ."</span></td></tr>";
    $message .= "<tr><td><p style='text-align:justify;font-size:18px;margin-top:2%'>If you haven't requested this email, there's nothing to worry about-you can safely ignore it.</p></td></tr>";
    $message .= '</tbody><table>';
    $message .= '</body></table>';
    $retval = mail ($to,$subject,$message,$headers);
    
    if($retval==true)
    {
        echo "11";
    }
    else
    {
        echo "00";
    }
?>
