") || strpos($message, "
") || strpos($message, "
") || strpos($message, "
") || strpos($message, "setLanguage($language, _BASEDIR."includes/phpmailer/phpmailer/language/"); // falls back to English when a translation is missing
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 = $from_email;
$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;
}
}
?>