邮件未从托管的Codeigniter应用程序发送 [英] Mail not sending from hosted codeigniter application

查看:74
本文介绍了邮件未从托管的Codeigniter应用程序发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gmail smtp已在localhost中成功配置,但是移到godaddy服务器后,同样的东西在远程中无法正常工作.它不会从应用程序发送任何邮件.

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.

这是我的gmail smtp配置.

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

推荐答案

尝试一下:

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

这篇关于邮件未从托管的Codeigniter应用程序发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆