SendSMTPMail: --- Using localhost ---");
echo("
toAddr = $toAddr");
echo("
fromAddr = $fromAddr");
echo("
bccAddr = $bccAddr");
echo("
msgTitle = $msgTitle");
echo("
msgBody = $msgBody");
return 1;
*/
//if($type > 0 && $rc === true)
if($type > 0)
{
//-------------------------------------------------------
//Using php mailer
//---------------
//requires php mailer be installed on server
//-------------------------------------------------------
if($_SERVER['HTTP_HOST'] == "127.0.0.1" || $_SERVER['HTTP_HOST'] == "localhost")
{
echo("
SendSMTPMail: --- Using localhost ---");
echo("
toAddr = $toAddr");
echo("
fromAddr = $fromAddr");
echo("
bccAddr = $bccAddr");
echo("
msgTitle = $msgTitle");
echo("
msgBody = $msgBody");
return 1;
} else {
//echo("
SendSMTPMail: --- Using website ---");
}
if(strlen(trim($toAddr)) <= 0) { return 0; }
$toList = explode(',', $toAddr, 24);
$toCnt = count($toList);
$bccCnt = 0;
if(strlen($bccAddr) > 0)
{
$bccList = explode(',', $bccAddr, 24);
$bccCnt = count($bccList);
}
$host = "mail.bridgesignup.com";
$username = "bsunotifications@bridgesignup.com";
$password = $_SESSION['bsuNoticePW'];
$mail = new PHPMailer;
//Enable SMTP debugging.
$mail->SMTPDebug = 0;
//Set PHPMailer to use SMTP.
$mail->isSMTP();
//Set SMTP host name
$mail->Host = $host;
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
//Provide username and password
$mail->Username = $username;
$mail->Password = $password;
//If SMTP requires TLS encryption then set it
//$mail->SMTPSecure = "tls";
//Set TCP port to connect to
//$mail->Port = 587;
//$mail->Port = 465;
$mail->Port = 25;
$mail->setFrom($fromAddr, "BSU Mail");
//$mail->From = $fromAddr;
//$mail->FromName = "BSU Mail";
//Add recipient(s)
for($i=0; $i<$toCnt; $i++)
{
if(strlen($toList[$i]) > 0)
{
$mail->addAddress($toList[$i], "");
}
}
//Add bcc
if($bccCnt > 0)
{
for($i=0; $i<$bccCnt; $i++)
{
$mail->addBCC($bccList[$i], "");
}
}
//$mail->isHTML(true);
$mail->Subject = $msgTitle;
$mail->Body = $msgBody;
//$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send()) {
//echo("
SMTP:" . $mail->ErrorInfo . "
"); $err = $mail->ErrorInfo; $str = "\nSMTPMail: Send error = $err"; WriteToErrorLog($str, 'data'); //--------------------------------- //if SMTP fails then try PHP mail() //--------------------------------- $rc = mail($toAddr, $msgTitle, $msgBody, "From: $fromAddr"); //$str = "\nSMTP => PHP($rc)" . $toAddr . "($err)"; $str = "\nSMTP => PHP($rc)" . $toAddr; //echo "".htmlentities($toList)." ".print_r($headers)."
"); $str = "\nSMTP => " . $toAddr; //WriteToLogFile($str, "data"); //WriteToErrorLog($str, "data"); } } else { //------------------------ //Using standard PHP mail //------------------------ $Body = $msgBody; $rc = mail($toAddr, $msgTitle, $Body, "From: $fromAddr"); if($rc) { //echo("