54 lines
2.0 KiB
PHP
54 lines
2.0 KiB
PHP
<?php
|
|
$themailsent="";
|
|
$sqlcheck="SELECT
|
|
Count(`mail_cybersocket`.`userid`)
|
|
FROM
|
|
`mail_cybersocket`
|
|
WHERE
|
|
`mail_cybersocket`.`userid` = ".$row["user_id"];
|
|
|
|
$querycount=mysql_query($sqlcheck);
|
|
$qcount = mysql_result($querycount,0);
|
|
|
|
if($qcount==0)
|
|
{
|
|
$sqlcsm="INSERT INTO `mail_cybersocket` (`mail_cybersocket`.`userid`) VALUES(".$row["user_id"].")";
|
|
$querycsm=mysql_query($sqlcsm);
|
|
$timestamp=date("m-d-Y H:i");
|
|
$sys_ea = str_replace('@b8world.com','',$smtpusername);
|
|
//need to set
|
|
$subject="Bateworld Award Nominations";
|
|
$recipient=$row["user_email"];
|
|
$username=$row["user_username"];
|
|
$mailbody=str_replace('[username]', $username, $thetemplate);
|
|
$mailbody= str_replace('[useremail]', $recipient, $mailbody);
|
|
$message=$mailbody;
|
|
$charset="UTF-8";
|
|
$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
|
|
try {
|
|
$mail = new PHPMailer();
|
|
$mail->IsSMTP(); // telling the class to use SMTP
|
|
$mail->Host = "b8world.com"; // SMTP server
|
|
$mail->SMTPAuth = true; // authentication enabled
|
|
$mail->Port = 587;
|
|
$mail->CharSet = $charset;
|
|
$smtpusername="mailservices@b8world.com";
|
|
$smtppassword="cJldETQ2V52o";
|
|
$mail->Username = $smtpusername; // SMTP account username
|
|
$mail->Password = $smtppassword; // SMTP account password
|
|
$mail->SetFrom("mailservices@b8world.com", 'Bateworld');
|
|
$mail->AddReplyTo("mailservices@b8world.com", 'Bateworld');
|
|
$mail->AddAddress($recipient);
|
|
$mail->Subject = $subject;
|
|
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
|
|
$mail->MsgHTML($message);
|
|
$mail->Send();
|
|
|
|
} catch (phpmailerException $e) {mail("porembaphilip@gmail.com", "MAIL ERROR", $e->errorMessage());echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
|
} catch (Exception $e) {
|
|
echo $e->getMessage(); //Boring error messages from anything else!
|
|
mail("porembaphilip@gmail.com", "MAIL ERROR", $e->getMessage());
|
|
}
|
|
$themailsent="Mail Sent";
|
|
}
|
|
?>
|