") || strpos($message, "
") || strpos($message, "
") || strpos($message, "
") || strpos($message, "SetLanguage($language, _BASEDIR."languages/mailer/");
else
$mail->SetLanguage("en", _BASEDIR."languages/mailer/");
if(!$smtp_host) {
$mail->IsMail( );
}
else {
$mail->IsSMTP( );
$mail->Host = $smtp_host;
$mail->SMTPAuth = true;
$mail->Username = $smtp_username;
$mail->Password = $smtp_password;
// Apply transport settings only when configured; otherwise leave PHPMailer
// defaults (and SMTPAutoTLS) in place. !empty() avoids 8.x warnings on
// not-yet-migrated installs where these globals are undefined.
if (!empty($smtp_port)) $mail->Port = (int) $smtp_port;
if (!empty($smtp_secure)) $mail->SMTPSecure = $smtp_secure; // '', 'tls', 'ssl'
// Optional handshake debugging, off unless $smtp_debug is set. Routed to the PHP error log.
if(!empty($smtp_debug)) {
$mail->SMTPDebug = 2;
$mail->Debugoutput = function($str, $level) { error_log("eFiction SMTP debug [$level]: ".trim($str)); };
}
}
$mail->CharSet = _CHARSET;
$mail->From = $siteemail;
$mail->FromName = $from_name;
$mail->AddAddress($to_email, $to_name);
$mail->AddReplyTo($from_email, $from_name);
if($cc) {
$cc = explode(", ", $cc);
foreach ($cc as $ccaddress) {
$mail->AddCC($ccaddress);
}
}
if ($bcc) {
$bcc = explode(", ", $bcc);
foreach ($bcc as $bccaddress) {
$mail->AddBCC($bccaddress);
}
}
if ($type == "plain") {
$mail->IsHTML(false);
} else {
$mail->IsHTML(true);
}
$mail->Subject = $subject;
$mail->Body = $message;
if(!$mail->Send()) {
$errorinfo = $mail->ErrorInfo;
error_log("eFiction sendemail failed for ".$to_email.": ".$errorinfo);
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
return false;
} else {
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
return true;
}
}
?>