我試圖使用CodeIgniter電子郵件類來編寫安全的SMTP電子郵件; SSL或TLS(首選)。在過去,我已經成功地將PHPMailer與Secure Auth和TLS結合使用。我相信這是一個安全的連接。 TLS顯示在電子郵件標題中。CodeIgniter:來自PHPMailer的SSL/TLS SMTP Auth電子郵件代碼
CodeIngiters的電子郵件類是否支持使用TLS安全SMTP認證?
請注意,這不是Gmail問題。我試圖用它與MS Exchange Server。我已經正確地確認了PHPMailer代碼的功能。
include_once('includes/class.phpmailer.php');
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->Host = 'www.domain.com';
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Port = '25';
$mail->Timeout = '60';
$mail->Username = '[email protected]';
$mail->Password = 'password';
$mail->From = '[email protected]';
$mail->FromName = 'Alerts';
$mail->Subject = 'Test from test email file.';
$mail->IsHTML(true);
$mail->MsgHTML('This is just a test.');
// To
$mail->AddAddress('[email protected]', 'Research');
$result = $mail->Send();
使用CodeIgniter我已經擴展了電子郵件類(MY_Email.php)。這個班在這裏發佈有點大。但是,這是我不斷收到的錯誤。
設置:
array(7) {
["smtp_host"]=> string(26) "tls://www.domain.com"
["smtp_port"]=> string(2) "25"
["smtp_user"]=> string(17) "[email protected]"
["smtp_pass"]=> string(9) "password"
["smtp_to_email"]=> string(26) "[email protected]"
["smtp_from_email"]=> string(26) "[email protected]"
["smtp_from_name"]=> string(24) "Test from Application"
}
錯誤消息:
fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:func(143):reason(267)
任何想法,原因是267?
您可以通過谷歌錯誤代碼來了解更多信息,或者只是在codeigniter中使用PHPMailer。您可以在CI的旁邊使用其他PHP庫,如果您已經有*正在工作的代碼*,這可能是一個好主意。 – hakre
如果你有它在PHPMailer中工作,那麼我只是將它作爲一個庫在CI中。我以前親自在CI的電子郵件課上遇到了問題,並且做了同樣的事情。 – fire