Sending email with gmail smtp with codeigniter email library |
[eluser]Unknown[/eluser]
hello every1 . This is my 1st post here. i have almost completed my project. But i can't send a single mail with CI ![]() please help me . class Email extends Controller { Code: function Email() I am getting this error A PHP Error was encountered Severity: Warning Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) Filename: libraries/Email.php Line Number: 1641 Using PORT 25/587 I got this error """A PHP Error was encountered Severity: Warning Message: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:func(119):reason(252) Filename: libraries/Email.php Line Number: 1641"""" I dont want to use phpmailer now. (Actually i have tried to use phpmailer,but i falied )
[eluser]dsloan[/eluser]
I had problems with this initially and got around it by loading the parameters into an array, then initialising the library using the array. Code: $config = Array(
[eluser]oste15[/eluser]
That solved the issue for me too Does this mean using config/email.php is deprecated? I was using $this->load->library('email'); and removing config/email.php and adding the $config array directly to the controller and using $this->load->library('email', $config); Worked
[eluser]miss_amylee[/eluser]
hy bapjon, how did u resolve the problem..actually, i did this last week and its working fine. i received d email to target email.btw, yesterday i run again d code and i got problem same as yours.. fsockopen error.. i really dun have any idea bout this error since the code are exactly same ( i used code given at first page). is dat problem with my server or else?thx for any helps guys.
[eluser]miss_amylee[/eluser]
sorry, this is my code: <?php class Test1 extends Controller{ function __construct() { parent::Controller(); } function index() { $data['pagetitle'] = 'Account Activation'; $email = $this->load->view('account/test1',$data,TRUE); $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => '#######@gmail.com', 'smtp_pass' => '#######', 'mailtype' => 'html', 'wordwrap' => TRUE ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('########@gmail.com', 'farah'); $this->email->to('######@yahoo.com'); $this->email->subject(' Testing testing testing....'); $this->email->message($email); if (!$this->email->send()) show_error($this->email->print_debugger()); else echo 'Your e-mail has been sent!'; } } ?>
[eluser]Unknown[/eluser]
I'm sorry, may i know the solve about this problem???i made a web n i found this problem to. This is my code : $config = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => '465', 'smtp_user' => '[email protected]', 'smtp_pass' => 'yyyyyy', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); $this->load->library('email',$config); $this->email->set_newline("\r\n"); $this->email->from($emailkontak, $namakontak); $this->email->to('[email protected]'); $this->email->subject("[".$tujuankontak."]"." ".$subjectkontak); $this->email->message($pesankontak); $this->email->send(); Please help me to solve this problem. Thnx for advance...
[eluser]HA[/eluser]
[quote author="dsloan" date="1255907523"]I had problems with this initially and got around it by loading the parameters into an array, then initialising the library using the array. Code: $config = Array( Worked great! Tks!
[eluser]Unknown[/eluser]
Hi im a beginner and still a little bit stuck.... My Code <?php class Email extends Controller { function Email() { parent::Controller(); $this->load->library('email'); } function index(){ // Collect data // Config Server $config_array = Array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'xxx', 'smtp_pass' => 'xxx', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('xxx'); $this->email->to('xxx'); $this->email->subject('Website Contact Message'); $this->email->message('Hello World'); $this->email->send(); echo $this->email->print_debugger(); } } ?> i am getting this response You did not specify a SMTP hostname. Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
|
Welcome Guest, Not a member yet? Register Sign In |