csrb/api/application/helpers/mymail_helper.php
2019-10-22 18:05:01 +05:30

51 lines
1.2 KiB
PHP

<?php
class myMail
{
public static function sendmyMail($from,$fromDisplayName,$toWhom,$subject,$mailContent)
{
$CI =&get_instance();
$CI->load->library('mymaillib');
$myMail = $CI->mymaillib->load();
$myMail->IsSMTP(); // Telling the class to use SMTP
$myMail->SMTPAuth = true;
$myMail->SMTPDebug = 0;
$myMail->SMTPSecure = "ssl";
$myMail->Host = 'bh-in-16.webhostbox.net'; // SMTP server
$myMail->Username = "noreply@ssa.sineedge.com"; // "The account"
$myMail->Password = "noreply@ssa"; // "The password"
$myMail->Port = 465; // "The port"
$myMail->addAddress($toWhom); // Name is optional
$myMail->From = $from;
$myMail->FromName = $fromDisplayName;
$myMail->isHTML(1); // Set emyMail format to HTML
$myMail->Subject = $subject;
$myMail->Body = $mailContent;
$myMail->AltBody = $mailContent;
//$logger = MYLOG::logFunction();
if(!$myMail->send()) {
log_message("ERROR",($myMail->ErrorInfo));
//echo $myMail->ErrorInfo;
} else {
log_message("ERROR",("### myMailer Send:".$toWhom));
//echo 'done..!';
}
}
}
?>