Using PHP, I'm attempting to route email through AuthSMTP (a hosted SMTP service). The problem is that the PEAR mail factory automatically tries to negotiation a TLS connection with the server. Rather than simply ignoring the attempt, AuthSMTP throws an error. I need a way to explicitly tell the Mailer class not to try to use TLS. Any suggestions?
$from = "Example <[email protected]>";
$to = $email;
$subject = "This is an email";
$body_text = "plain text here";
$body_html = "<h1>HTML here!</h1>";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$mime = new Mail_mime('rn');
$mime->setTXTBody($body_text);
$mime->setHTMLBody($body_html);
$body = $mime->get();
$hdrs = $mime->headers($headers);
$host = "mail.authsmtp.com";
$port = 26;
$username = "my_username";
$password = "whatever_password";
$mailer = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'port' => $port,
'username' => $username,
'password' => $password));
if (PEAR::isError($res)) {
throw new Exception($res->getMessage());
} else {
return true;
}
AuthSMTP is giving me the following error:
SMTP: Invalid response code received from server (code: 428, response: 4.0.0 Your account is using SSL - either disable it in your email client or enable it at http://control.authsmtp.com)