CodeIgniter Forums

Full Version: email-send(); - fsockopen error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good afternoon guys,

when I send my contact form via "localhost " , is returning the following error:

Quote:A PHP Error was encountered
Severity: Warning
Message: fsockopen():
Filename: libraries/Email.php
Line Number: 1986
Backtrace:
File: C:\wamp64\www\tpadua\application\controllers\contato.php
Line: 38
Function: send

File: C:\wamp64\www\tpadua\index.php
Line: 292
Function: require_once

Code:
location: config/email.php

//teste offline
$config['protocol']='smtp';
$config['charset']='utf-8';
$config['mailtype']='html';
$config['wordwrap'] = TRUE;
$config['smtp_host']='smtp.googlemail.com';
$config['smtp_port']='465';
$config['smtp_user']='[email protected]';
$config['smtp_pass']='****';


location: controllers/contato/

public function enviar_contato(){
            $info['nome']         = $this->input->post('nome');
            $info['email']        = $this->input->post('email');
            $info['assunto']   = $this->input->post('assunto');
            $info['msg']          = $this->input->post('mensagem');



            $this->load->library('email');
            $this->email->set_newline("\r\n");
            $this->email->clear();

            $this->email->from($info['email'], $info['nome']);
            $this->email->to('[email protected]');
            $this->email->subject("E-mail de teste");
            $this->email->reply_to('[email protected]', 'E-mail resposta');
            $this->email->message($this->load->view('admin/contato', $info, TRUE));
            $this->email->send();
    

         $this->load->view('admin/contato');
    }




I want to know if my setting is correct or is missing some configuration on my codeigniter .
For your SMTP host, try setting it like this:


PHP Code:
$config['smtp_host'] = 'ssl://smtp.gmail.com'
OR

PHP Code:
$config['smtp_host'] = 'ssl://smtp.googlemail.com'


I'm not sure this second one is correct, but you have specified the smtp host like that. You are just missing the ssl:// in front.