File: /var/www/content-sp/work-sp/mail_function.php
<?php
require_once '/var/www/content-sp/work-sp/phpmailer/class.phpmailer.php';
function smtpMail($fromname,$replyto,$title, $subject, $content, $email_id)
{
include 'sp_config.php';
$mailDetails = $spConn->query("SELECT username, password,region_host from `wp_aat93akkcv_tt_config` where type='Mail' and status='1'");
$md = $mailDetails->fetch_assoc();
// echo $mailDetails->error;
$mail = new PHPMailer();
$mail->IsSMTP(true); // SMTP
$mail->SMTPAuth = true; // SMTP authentication
$mail->SMTPSecure = 'tls';
$mail->Mailer = "smtp";
$mail->SMTPDebug = false;
$mail->CharSet = "utf-8";
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
$mail->Host = $md['region_host']; // Amazon SES server, note "tls://" protocol
$mail->Port = 587; // set the SMTP port
$mail->Username = $md['username']; // SES SMTP username
$mail->Password = $md['password'];
$mail->SetFrom($fromname, $title);
$mail->AddReplyTo($replyto, $title);
$mail->Subject = $subject;
$mail->MsgHTML($content);
$mail->AddAddress($email_id, $email_id);
if ($mail->Send()) {
return 1;
} else {
return 0;
}
}
function smtpMailWht($fromname,$replyto,$title, $subject, $content, $email_id)
{
include 'wht_config.php';
$mailDetails = $whtConn->query("SELECT username, password,region_host from `wp_aat93akkcv_tt_config` where type='Mail' and status='1'");
$md = $mailDetails->fetch_assoc();
// echo $mailDetails->error;
$mail = new PHPMailer();
$mail->IsSMTP(true); // SMTP
$mail->SMTPAuth = true; // SMTP authentication
$mail->SMTPSecure = 'tls';
$mail->Mailer = "smtp";
$mail->SMTPDebug = false;
$mail->CharSet = "utf-8";
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
$mail->Host = $md['region_host']; // Amazon SES server, note "tls://" protocol
$mail->Port = 587; // set the SMTP port
$mail->Username = $md['username']; // SES SMTP username
$mail->Password = $md['password'];
$mail->SetFrom($fromname, $title);
$mail->AddReplyTo($replyto, $title);
$mail->Subject = $subject;
$mail->MsgHTML($content);
$mail->AddAddress($email_id, $email_id);
if ($mail->Send()) {
return 1;
} else {
return 0;
}
}