简体   繁体   中英

Sending Email through CodeIgniter

I want to send a mail through Tank Auth(a CodeIgniter library)

I am getting the error:

A PHP Error was encountered Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?)

Filename: libraries/Email.php

Line Number: 1689

i am using gmail

my php.ini file has the line without comment

extension=php_openssl.dll

some conf in Email.php:

var $useragent      = "CodeIgniter";    
var $mailpath       = "/usr/sbin/sendmail";//i dont know what should i write here
var       $protocol     = "smtp";   
var $smtp_host      = "ssl://smtp.gmail.com";        
var $smtp_user      = "mymail@gmail.com";
var $smtp_pass      = "mypass";
var $smtp_port      = "465";    
var $smtp_timeout   = 30;
var $smtp_crypto    = "";
var $wordwrap       = TRUE;         
var $wrapchars      = "76";         
var $mailtype       = "text";       
var $charset        = "utf-8";      
var $multipart      = "mixed";  
var       $alt_message  = '';       
var $validate       = FALSE;    
var $priority       = "3";      
var $newline        = "\r\n";       
var       $crlf     = "\n";

where might the problem be?

我会尝试在Windows http://code.google.com/p/openssl-for-windows/上重新安装openssl扩展名

edit your code line from

var $smtp_host  = "ssl://smtp.gmail.com";  

to

var $smtp_host  = "ssl://smtp.googlemail.com"; 

i think it will work

To use Google SMTP in CodeIgniter you need to make 2 (two) changes into your Gmail account setting: (NB Please be aware that it is now easier for an attacker to break into your account -says Google)

  1. Set off 2-step Verification.
  2. Allow less secure apps: ON (or Enable)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM