2017-05-12 4 views
0

私はニュースレターの方法を使用していますが、複数のメールを送信すると、2番目のメールから究極のメールに失敗します。私はどこに問題があるのか​​分からない。ここでCodeigniter、複数のメールを送信するとエラーが発生する

私のコード:私のエラーの

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

      $this->email->from('[email protected]', 'xxxxxx'); 
      $data = array(); 
      $data["content"] = $contenuto; 

      foreach($result->result() as $row){ 
       $this->email->clear(TRUE); 
       $data["footer_link"] = "<p><a href=\"http://localhost/xxxxx/public/landing/unsub/". $row->email ."\">Clicca qui</a> per disinscriverti dalla newsletter</p>"; //unsubscribe newsletter 

       $this->email->to($row->email); 
       $body = $this->load->view("templates/entire_page.php", $data, TRUE); 

      $this->email->subject($subject); 
      $this->email->message($body); 
      $this->email->set_mailtype("html"); 

      if($this->email->send()){ 
       echo $row->email.': email inviata con successo!<br>'; //email sent 
      }else{ 
       echo $row->email.": Impossibile inviare l'email: Errore.<br>"; //email not sent 
      } 

      } 

例:

[email protected]: email inviata con successo! (sented) 
[email protected]: Impossibile inviare l'email: Errore. (not sented) 
[email protected]: Impossibile inviare l'email: Errore. (not sented) 

私はこの記事ではイタリアのために非常に残念ですが、私は相対的な翻訳でそれをコメントしました。 私は明確であったことを願っています。

+0

[返されたエラーメッセージが何であるかを確認するために、 'print_debugger()を'使用してみてください。(http://www.codeigniter.com/user_guide/libraries/email。 html#CI_Email :: print_debugger) – ourmandave

答えて

0

解決しました。私は "クリア"の後に "from"を移動しました。

ここコード:

 $data = array(); 
     $data["content"] = $contenuto; 

     foreach($result->result() as $row){ 
     $this->email->clear(TRUE); 
     $this->email->from('[email protected]', 'xxxxxx'); 
     // ...other code... 
関連する問題