【问题标题】:CodeIgniter Send Email doesn't workCodeIgniter 发送电子邮件不起作用
【发布时间】:2017-10-21 19:02:00
【问题描述】:

我已经使用 codeigniter 创建了一个电子邮件发送。在过去的几个月里,它运行良好。当我再次检查时,它不再发送电子邮件了。

这是我的代码:

 public function send_mail($registration_info_id){

    $config_mail = $this->main_m->get_all('emails');
    $all_mails="";
        foreach($config_mail as $email){
            $all_mails.= $email['email'].',';
        }

    $supply_email = rtrim($all_mails,",");


    $registration_info = $this->main_m->get_where('registration_info', array('registration_info_id' => $registration_info_id));
    $personal_info = $this->flight_travel_request_m->personal_info_per_person($registration_info_id);
    $cc_details = $this->main_m->get_where('payment_credit_card_details', array('registration_info_id' => $registration_info_id));
    $full_name  = $personal_info['firstname']." ".$personal_info['lastname'];

    $data = array(
        'registration_info' => $registration_info,
        'personal_info' => $personal_info,
        'cc_details' => $cc_details
        );

    //$this->load->view('email_acknowledgement/acknowledgement', $data);
    $message=$this->load->view('email_acknowledgement/acknowledgement', $data, true);

    $this->load->library('email');

    $this->email->from('sample@site.com', 'SiteName');
    $this->email->to($personal_info['email'], $full_name); 
    $this->email->reply_to('sample@site.com', 'SiteName');
    $this->email->bcc($supply_email); 
    $this->email->subject('Arrival Departure Transportation Service');
    $this->email->message($message);    
    if(!empty($attachment)){$this->email->attach($attachment);}
    $this->email->set_mailtype('html'); 

    if($this->email->send())
     {
      echo 'Email sent.';
     }
     else
    {
     show_error($this->email->print_debugger());
    }
}

它与Email Sent 相呼应,但是我无法在我的电子邮件地址上收到任何电子邮件。 它以前工作正常。

提前致谢

【问题讨论】:

  • 如果之前运行良好,问题可能不在代码中,而在环境中的某个地方。检查电子邮件服务器设置:用户、密码、端口、垃圾邮件过滤器、其他安全问题...尝试发送到不同的电子邮件地址、不同的电子邮件服务器进行测试。
  • 是的先生,它过去工作得很好......我也尝试过在其他电子邮件上发送它,但他们无法收到电子邮件......奇怪的是该方法返回Email Sent。所以可能代码没有问题。
  • @MarcM 我已经尝试创建一个简单的 php 邮件功能,但它可以工作......但是 codeigniter 邮件功能仍然不发送电子邮件。
  • 看看stackoverflow.com/questions/17982704/… 有几个配置建议需要考虑。

标签: php codeigniter email


【解决方案1】:

请试一试。

$config['protocol'] = 'smtp';
$config['validate'] = 'FALSE';

希望对你有用

并查看此链接Codeigniter $this->email->send() not working while mail() does

【讨论】:

  • 我正好解决了这个问题,客户端提供的域名邮箱好像还不存在,所以我创建了一个域名邮箱并使用...
  • 为什么验证错误? @Md.Jewel Mia
  • 这个解决方案和建议的链接问题的所有解决方案都不起作用。
猜你喜欢
  • 1970-01-01
  • 2018-09-21
  • 2017-11-30
  • 2014-06-17
  • 2015-04-09
  • 2015-11-03
  • 2018-02-06
  • 1970-01-01
  • 2013-01-07
相关资源
最近更新 更多