Mail not sending from hosted codeigniter application [duplicate]

让人想犯罪 __ 提交于 2020-06-02 05:34:19

问题


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";

回答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();
        }
}


来源:https://stackoverflow.com/questions/34381233/mail-not-sending-from-hosted-codeigniter-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!