isSMTP(); // Set mailer to use SMTP $mail->Host = $configArray['email_host']; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $from ; // SMTP username //$mail->Password = $configArray['email_password']; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = $configArray['email_port']; // TCP port to connect to $mail->isHTML(true); // Sender info $mail->setFrom($from, 'OHC'); $mail->addReplyTo($from, 'OHC'); //$from=$configArray['email_username']; $subject = "Test Email"; $ccList = "manojdubeyonline@gmail.com"; $mail_content = "

Thank you for your interest to our OHCTECH-Occupational Health Software and Solutions. We will soon connect and share details as per the details shared by you.

Regards,

OHCTECH TEAM

"; $toList = "manoj@ohctech.com,manoj@techsyneric.com"; function send_mail($toList, $ccList, $subject, $messageBody, $remarks) { error_log("email_sender send_mail"); error_log("toList:" . $toList); error_log("ccList:" . $ccList); error_log("subject:" . $subject); error_log("mail_content:" . $messageBody); $mail = new PHPMailer; /*$mail_data = explode(',',$str_dat); //unset("info@ohctech.com"); $mail->SMTPDebug = 2; //enable debugging if failure $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = "mail.ohctech.com"; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = "info@ohctech.com"; // SMTP username $mail->Password = "Tikora@1234"; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port ="587"; // TCP port to connect to $mail->isHTML(true); // Sender info $mail->setFrom("info@ohctech.com", 'OHC'); $mail->addReplyTo("info@ohctech.com", 'OHC'); $from="info@ohctech.com"; */ $from="manoj.dubey@tvsmotor.com"; $host ="cust81834-s.out.mailcontrol.com"; $headers = "From: OHCTECH\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $mail_content = "Welcome to OHC. Your OTP to verify Your Email ID is"; $toList = str_replace(' ', ',', $toList); $toList = str_replace(';', ',', $toList); $ccList = str_replace(' ', ',', $ccList); $ccList = str_replace(';', ',', $ccList); $toList_arr = preg_split("/\,/", $toList); $ccList_arr = preg_split("/\,/", $ccList); try { $mail->isSMTP(); // Set mailer to use SMTP $mail->SMTPDebug = 2; $mail->Host = $host;//getConfigKey('email_host'); // Specify main and backup SMTP servers $mail->SMTPAuth = false; // Enable SMTP authentication $mail->Username = $from; // SMTP username // $mail->Password = getConfigKey('email_password'); // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 25;//getConfigKey('email_port'); // TCP port to connect to $mail->isHTML(true); // Sender info $mail->setFrom($from, 'OHC'); $mail->addReplyTo($from, 'OHC'); foreach ($toList_arr as $toaddr) { $mail->addAddress($toaddr); } foreach ($ccList_arr as $ccaddr) { $mail->addCC($ccaddr); } $style = ""; $mail->Subject = $subject; $mail->Body = $style . $messageBody . $remarks; error_log("email_sender done settings"); if (!$mail->send()) { echo "Message could not be sent. Mailer Error: " . $mail->ErrorInfo; error_log('Message could not be sent. Mailer Error: ' . $mail->ErrorInfo); } else { echo "Message has been sent"; error_log("Message has been sent"); } error_log('Message has been sent.'); } catch (phpmailerException $e) { echo $e->errorMessage(); //Pretty error messages from PHPMailer } catch (Exception $e) { echo $e->getMessage(); //Boring error messages from anything else! } } send_mail($toList, $ccList, $subject,$mail_content,''); ?>