File: include/class.email.php
remove:
if($smtp){ //Send via SMTP
$mail = mail:('smtp',
array ('host' => $smtp,
'port' => $smtp,
'auth' => $smtp?true,
'username' => $smtp,
'password' => $smtp,
'timeout' =>20,
'debug' => false,
));
$result = $mail->send($to, $headers, $body);
if(!PEAR:($result))
return true;
$alert=sprintf("Unable to email via %s:%d \n\n%s",$smtp,$smtp,$smtp);
Sys:(LOG_ALERT,'SMTP Error',$alert,false);
//print_r($result);
}
insert:
if ($smtp) {
$from = $this->getEmail();
$fromname = $this->getName();
$subject = stripslashes(preg_replace("/(\r\n|\r|\n)/s",'', trim($subject)));
$to = preg_replace("/(\r\n|\r|\n)/s",'', trim($to));
$headers = array('Message-ID' =>'<'.Misc:(6).''.time().'-'.$this->getEmail().'>',
'X-Mailer' =>'osTicket v 1.6'
);
$body = stripslashes(preg_replace("/(\r\n|\r)/s", "\n", trim($message)));
$body = eregi_replace("",'',$body);
// PHPMailer
$mail = new PHPMailer();
$mail->SetLanguage('br', INCLUDE_DIR);
$mail->IsSMTP();
$mail->IsHTML(False);
$mail->CharSet = 'UTF-8';
$mail->From = $from;
$mail->FromName = $fromname;
$mail->Subject = $subject;
$mail->AddAddress($to);
$mail->AddReplyTo($from, $fromname);
$mail->AddCustomHeader('Message-ID:'.$headers);
$mail->AddCustomHeader('X-Mailer:'.$headers);
if($attachment && $attachment && is_readable($attachment)) {
$mail->AddAttachment($attachment, $attachment, 'base64', $attachment);
}
$mail->Host = $smtp;
$mail->SMTP_PORT = $smtp;
$mail->SMTPAuth = $smtp ? true : false;
$mail->Username = $smtp;
$mail->Password = $smtp;
$mail->Timeout = 20;
$mail->SMTPDebug = False;
$mail->SMTPSecure = 'tls';
$mail->Body = $message;
if ($mail->Send()) return True;
$alert = sprintf("Unable to email via %s:%d \n\n%s", $smtp, $smtp, $smtp);
Sys:(LOG_ALERT,'SMTP Error', $alert,false);
}
remove:
if(!$errors && $vars) { //Check SMTP login only.
require_once 'Mail.php'; // PEAR Mail package
$smtp = mail:('smtp',
array ('host' => $vars,
'port' => $vars,
'auth' => $vars?true,
'username' => $vars,
'password' => $vars,
'timeout' =>20,
'debug' => false,
));
$mail = $smtp->connect();
if(PEAR:($mail)) {
$errors='<br>Unable to login. Check SMTP settings.';
$errors='<br>'.$mail->getMessage();
}else{
$smtp->disconnect(); //Thank you, sir!
}
}
and insert:
if(!$errors && $vars) {
// PHPMailer
$mail = new PHPMailer();
$mail->SetLanguage('br', INCLUDE_DIR);
$mail->IsSMTP();
$mail->Host = $vars;
$mail->SMTP_PORT = $vars;
$mail->SMTPAuth = $vars?true;
$mail->Username = $vars;
$mail->Password = $vars;
$mail->Timeout = 20;
$mail->SMTPDebug = False;
$mail->SMTPSecure = "tls";
if ($mail->SmtpConnect()) {
$mail->SmtpClose();
}
else {
$errors = '<br>Unable to login. Check SMTP settings.';
$errors = '<br>'.$mail->ErrorInfo;
}
}