简体   繁体   中英

I would like to send email using SMTP server with codeigniter

I'm try to sending email using SMTP server with codeIgniter
i have code and its working fine on localhost but not on server, i have done lots of research and try many code but it's still not working.

$config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => 'xxxxx@gmail.com',
        'smtp_pass' => 'xxxxxxx',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('xxx@gmail.com', 'Blabla');
    $list = array('xxx@gmail.com','xxxxx@gmail.com');
    $this->email->to($list);
    $this->email->reply_to('xxxxx@gmail.com', 'Explendid Videos');
    $this->email->subject('This is an email test');
    $this->email->message('It is working. Great!');

    $result = $this->email->send();

Error-
The following SMTP error was encountered: 111 Connection refused Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

please edit your autoload to

$autoload['libraries'] = array('database','email');

please advise if you are still getting an error...

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