0

Gmail smtp is configured successfully in localhost, but the same thing not working in remote after moved to godaddy server. It is not send any mails from the application.

This is my gmail smtp configuration.

$config ['protocol'] = 'smtp';
$config ['smtp_host'] = 'ssl://smtp.gmail.com';
$config ['smtp_port'] = '465';
$config ['smtp_user'] = 'xxx@gmail.com';
$config ['smtp_pass'] = 'xxxx';
$config ['mailtype'] = 'html';
$config ['charset'] = 'iso-8859-1';
$config ['wordwrap'] = TRUE;
$config ['newline'] = "\r\n";
Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
jithin mohan
  • 75
  • 1
  • 2
  • 12

1 Answers1

1

try this:

function send_email(){
$config = array(
            'protocol' => 'smtp',
              'smtp_host' => 'ssl://smtp.gmail.com',
              'smtp_port' => 465,
             'smtp_user' => 'adc@gmail.com', // change it to yours
             'smtp_pass' => 'adcxc', // change it to yours
             'mailtype' => 'html',
             'charset' => 'UTF-8',
             'wordwrap' => TRUE
          ); 
        $this->load->library('email',$config);
        $this->email->set_newline("\r\n");
        $this->email->from(abc@gmail.com);
        $this->email->to(xyz@gmail.com);


        $this->email->subject("test");
        $this->email->message("message");

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


        if ($result) {
            echo  "Success";

        }
        else{
            echo $this->email->print_debugger();
        }
}
mrdragon
  • 247
  • 1
  • 2
  • 14