0

I want to send email using Google mail SMTP by CodeIgniter...

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

            $this->email->from('abdikurniawan060395@gmail.com', 'Abdi Kurniawan');
            $this->email->to('juventini.parepare@gmail.com'); 

            $this->email->subject('Email Test');
            $this->email->message('Testing the email class.');  

            $this->email->send();

I try the code above in local, it works.. but, when I try it in my VPS, it shows an error like this:

A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)

Filename: libraries/Email.php

Line Number: 2063

Grokify
  • 15,092
  • 6
  • 60
  • 81
  • Please check this, its so many time repeated question, you can find your answer here, [unable-to-find-the-socket-transport-ssl-did-you-forget-to-enable-it-when-you](https://stackoverflow.com/questions/21962849/unable-to-find-the-socket-transport-ssl-did-you-forget-to-enable-it-when-you) – Ritesh Khatri Oct 25 '17 at 14:19
  • im using linux.. – Abdi Kurniawan Oct 26 '17 at 02:03
  • so what if you doing in local host then update your php.ini and then restart server or on live you can edit it using ssh command line from the terminal. – Ritesh Khatri Oct 26 '17 at 05:32
  • i think the problem was on my VPS, the mailpath not exist – Abdi Kurniawan Oct 26 '17 at 06:17

0 Answers0