<?php


use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

// Include PHPMailer
require 'src/Exception.php';
require 'src/PHPMailer.php';
require 'src/SMTP.php';

/*$email = 'gawarepriyanka520@gmail.com';
$to = 'chaudhari.lalitform@outlook.com';
$first_name = 'lalit';
//$to = 'jpksoft2020@gmail.com';
 $mail = new PHPMailer(true);
$host = 'smtp.gmail.com';//'eat2eat.visionhelpdesk.com';
$username = 'gawarepriyanka520@gmail.com';//'eattoeatsmtp@eat2eat.visionhelpdesk.com';
$pass = 'kfbptxpljwvypypv'; //'Od&YesA8v7AW';
    try {
        // SMTP Configuration
        $mail->isSMTP();
        $mail->Host = $host;
        $mail->SMTPAuth = true;
        $mail->Username = $username; // Your SMTP username
        $mail->Password = $pass; // Your SMTP password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
        $mail->Port = 587;

        // Email Details
        $mail->setFrom($email, $first_name);
        $mail->addAddress($to); // Your receiving email
        $mail->isHTML(true);
        $mail->Subject = "New Contact Form Submission";
        ///$mail->Body = "
            <strong>Full Name:</strong> first_name<br>
            <strong>Full Name:</strong> last_name<br>
            <strong>Email:</strong> email<br>
            <strong>Mobile:</strong> mobile<br>
            <strong>City:</strong> city<br>
            <strong>Message:</strong> message
        ";
        $mail->Body = "Test Test Test Test Test Test Test ";

        // Send Email
        $mail->send();
        
        echo "<script>
                alert('Form submitted successfully!');
               
              </script>";
        exit;

    } catch (Exception $e){
        echo "<script>alert('Message could not be sent. Mailer Error: {$mail->ErrorInfo}');</script>";
    }*/



/*$server_smtp = "smtp.gmail.com";
//$server_imap = "imap.hostinger.com";
$email_account = "jpksoft2020@gmail.com";
$email_password = "Q!W@E#R$T%";
// Recipient
$recipient = "chaudhari.lalitform@outlook.com";

// Stop making changes below this line

use PHPMailer\PHPMailer\PHPMailer;
require "./phpmailer/autoload.php";
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;

$mail->Host = $server_smtp;
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
//$mail->Username = 'eattoeatsmtp@eat2eat.visionhelpdesk.com';
$mail->Username = 'jpksoft2020@gmail.com';
$mail->Password = $email_password;

$mail->setFrom($email_account, "");
$mail->addReplyTo($email_account, "");
$mail->addAddress($recipient, "");
$mail->Subject = "This means that emails work fine.";
$mail->msgHTML("<h1>Incoming message to Houston</h1>");

if (!$mail->send()) {
	echo "error: ".$mail->ErrorInfo;
} else {
	echo "Message sent";
	if(!empty($server_imap)) {
		 Add the message to the IMAP.Sent mailbox
		$mail_string = $mail->getSentMIMEMessage();
		$imap_stream = imap_open("{".$server_imap."}", $email_account, $email_password);
		imap_append($imap_stream, "{".$server_imap."}INBOX.Sent", $mail_string);
	}
}

die;*/



/*use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
 
require 'vendor/autoload.php';*/
  ////////////// woring
/*$to = 'chaudhari.lalitform@outlook.com';
$first_name = 'lalit';
 //$mail = new PHPMailer(true);
$host = 'smtp.gmail.com';//'eat2eat.visionhelpdesk.com';
$username = 'gawarepriyanka520@gmail.com';//'eattoeatsmtp@eat2eat.visionhelpdesk.com';
$pass = 'kfbptxpljwvypypv'; //'Od&YesA8v7AW';

$mail = new PHPMailer(true);
  ////////////// woring
try {
    $mail->SMTPDebug = 2;                                       
    $mail->isSMTP();                                            
    $mail->Host       = 'mail.drmanojkumar.com;';                    
    $mail->SMTPAuth   = true;                             
    $mail->Username   = 'contact@drmanojkumar.com';                 
    $mail->Password   = 'contact@007';                        
    $mail->SMTPSecure = 'tls';                              
    $mail->Port       = 587;  
 
    $mail->setFrom('contact@drmanojkumar.com', 'Name');           
    $mail->addAddress('sachin.s.chaudhari@gmail.com','testst');
    //$mail->addAddress('receiver2@gfg.com', 'Name');
      
    $mail->isHTML(true);                                  
    $mail->Subject = 'Subject';
    $mail->Body    = 'HTML message body in <b>bold</b> ';
    $mail->AltBody = 'Body in plain text for non-HTML mail clients';
    $mail->send();
    echo "Mail has been sent successfully!";
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}*/


$to = 'chaudhari.lalitform@outlook.com';
$first_name = 'lalit';
 //$mail = new PHPMailer(true);
$host = 'smtp.gmail.com';//'eat2eat.visionhelpdesk.com';
$username = 'gawarepriyanka520@gmail.com';//'eattoeatsmtp@eat2eat.visionhelpdesk.com';
$pass = 'kfbptxpljwvypypv'; //'Od&YesA8v7AW';

$mail = new PHPMailer(true);
  ////////////// woring
try {
    $subject = "A test Message!";
$message = "A test message from the new PHPmailer routines...  Did you get it?";
$email_address = "sachin.s.chauddhari@gmail.com";
//  PHP-Mailer code to send an email ( Could be put into a function if needed or just replace the old code! )
//$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "jpksoft2020@gmail.com";
$mail->Password = "Q!W@E#R$T%";
$mail->SetFrom("jpksoft2020@gmail.com");
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AddAddress($email_address);
    echo "Mail has been sent successfully!";
} catch (Exception $e) {
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}























////////////////////////
// PHPMailer example
// heiko@hostinger.com
////////////////////////

// Login credentials
/*$server_smtp = "eat2eat.visionhelpdesk.com";
//$server_imap = "imap.hostinger.com";
$email_account = "donotreply@eat2eat.com";
$email_password = "Od&YesA8v7AW";
$recipient = "chaudhari.lalitform@outlook.com";

// Stop making changes below this line

use PHPMailer\PHPMailer\PHPMailer;
require "./phpmailer/autoload.php";
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;

$mail->Host = $server_smtp;
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Username = 'eattoeatsmtp@eat2eat.visionhelpdesk.com';
$mail->Password = $email_password;

$mail->setFrom($email_account, "");
$mail->addReplyTo($email_account, "");
$mail->addAddress($recipient, "");
$mail->Subject = "This means that emails work fine.";
$mail->msgHTML("<h1>Incoming message to Houston</h1>");

$ret = $mail->send();
if($ret!=1){
	echo "error: ".$mail->ErrorInfo;
} else {
	echo "Message sent";
	/*if(!empty($server_imap)) {
		// Add the message to the IMAP.Sent mailbox
		$mail_string = $mail->getSentMIMEMessage();
		$imap_stream = imap_open("{".$server_imap."}", $email_account, $email_password);
		imap_append($imap_stream, "{".$server_imap."}INBOX.Sent", $mail_string);
	}*/
//}
?>
