0

I am using gmail smtp code to send mail and I have a goDaddy shared server here is my code to send mail :

$this->load->library('email');
        $config = array(
            'protocol'  => 'smtp',
            'smtp_host' => 'ssl://smtp.gmail.com',
            'smtp_port' => 465,
            'smtp_user' => 'xxxxx@gmail.com',
            'smtp_pass' => 'xxxxx',
            'mailtype'  => 'html',
            'charset'   => 'utf-8',
            "wordwrap" => TRUE
        );
        $this->email->initialize($config);
        $this->email->set_mailtype("html");
        $this->email->set_newline("\r\n");
        $this->email->to($mailConfig['to']);
        $this->email->from($mailConfig['from'],'xxxxxxxx');
        $this->email->subject($mailConfig['subject']);
        $this->email->message($message);
        return $this->email->send();

but I am not getting success, it is giving me a warning

<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message:  fsockopen(): unable to connect to ssl: //smtp.gmail.com:465 (Connection refused)</p>
<p>Filename: libraries/Email.php</p>
<p>Line Number: 2069</p>

Can anyone help me. I have already try this in local server and this code has working perfectly

Bhargav Tailor
  • 442
  • 4
  • 8
  • GoDaddy shared services are blocked from sending email. You have two choices: 1) Use GoDaddy's relay server or 2) Get a Dedicated or VPS plan. – kainaw Dec 30 '19 at 19:16
  • Hii @kainaw Thank you let me check what I can do with this – Bhargav Tailor Dec 30 '19 at 19:42
  • Does this answer your question? [Send email using the GMail SMTP server from a PHP page](https://stackoverflow.com/questions/712392/send-email-using-the-gmail-smtp-server-from-a-php-page) – Cornel Raiu Dec 30 '19 at 21:21
  • @BhargavTailor which library are you using to send the email? – Progman Dec 30 '19 at 23:43
  • Hi Progman, Here is the link of library which i have been integrated to my project : https://codeigniter.com/user_guide/libraries/email.html – Bhargav Tailor Dec 31 '19 at 04:36

0 Answers0