i'm trying to use the codeigniter email class to write a secure smtp email; either ssl or tls (preferred). in the past, i've successfully used phpmailer with secure auth and tls. i believe it was a secure connection. tls shows up in the email header.
does codeingiters' email class support secure smtp authentication with tls?
note, this is not a gmail question. i'm trying to use it with an ms exchange server. i've confirmed the phpmailer code below functions correctly.
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 = 'user@domain.com';
$mail->password = 'password';
$mail->from = 'alerts@domain.com';
$mail->fromname = 'alerts';
$mail->subject = 'test from test email file.';
$mail->ishtml(true);
$mail->msghtml('this is just a test.');
// to
$mail->addaddress('alerts@domain.com', 'research');
$result = $mail->send();
with codeigniter i've already extended the email class (my_email.php). the class is a bit big to post here. but, here's the error i keep getting.
settings:
array(7) {
["smtp_host"]=> string(26) "tls://www.domain.com"
["smtp_port"]=> string(2) "25"
["smtp_user"]=> string(17) "alerts@domain.com"
["smtp_pass"]=> string(9) "password"
["smtp_to_email"]=> string(26) "user@domain.com"
["smtp_from_email"]=> string(26) "user@domain.com"
["smtp_from_name"]=> string(24) "test from application"
}
error message:
fsockopen(): ssl operation failed with code 1. openssl error messages: error:1408f10b:ssl routines:func(143):reason(267)
any idea what reason 267 is?
found a solution on the ci forums.
exchange email class patch http://codeigniter.com/forums/viewthread/158882/
it is initiating tls after smtp server has been connected.
worked for me. jeff