为什么有时我的电子邮件没有得到他们的地址加载?

时间:2013-06-05 10:37:23

标签: php codeigniter

我的应用会在客户购买时发送确认电子邮件。 8/10发送正常,但2/10回来时显示错误消息,表示电子邮件地址丢失且无法尝试发送。

我已经检查了提供电子邮件的SESSION,它似乎工作正常。我想知道配置或代码中是否可能有某些东西可以调整以修复问题。

非常感谢!

这是我现有的配置/代码:

 <?php

$config['wrapchars'] = '76';
  $config['mailtype'] = 'html';
  $config['wordwrap'] = TRUE;
  $config['crlf'] = "\r\n";
  $config['newline'] = "\r\n";
  $this->email->initialize($config);

  $templates = $this->MEmail->getEmailTemplate('2'); 
  $email = $_SESSION['email'];

  foreach($templates->result() as $row)
  {$message = $row->Contents;
   $templatename = $row->Name;
  }

  $pickupdate = $_POST['pickupdate'];
  $pickuplocation = $_POST['location'];
  $start_time=$data['times']['start_time'];
  $endtime=$data['times']['endtime'];

  $data = array(
               'heading' => 'Country Lane Farms: Your Order Details',
               'message' =>$message,
      'firstname' => $_SESSION['firstname'],
           'lastname' => $_SESSION['lastname'],
      'order_num' => $_SESSION['order_num'],
      'totalprice' => $_SESSION['totalprice'],
      'orders'=> $_SESSION['cart'],
      'pickupdate' => $pickupdate,
      'pickuplocation'=> $pickuplocation,
      'start_time' => $start_time,
      'endtime' => $endtime
          );


   $html = $this->load->view('/templates/confirm_order.php',$data, TRUE);
   $this->email->clear();
   $this->email->from('orderdesk@countrylanefarms.com', 'Country Lane Farms (Jerry)');
   $this->email->to($email);
   $this->email->subject($templatename);
   $this->email->message($html); 
   $this->email->send();

?>  

1 个答案:

答案 0 :(得分:1)

唯一的原因是会议正在逐渐消失。我建议创建一个TExtFile或数据库日志[无论如何你想要日志]并在你的日志中记录会话变量,并发送或不发送电子邮件的消息。这将告诉你可能发生了什么,也许你想在日志中打印其他变量。