0

我想向我的所有客户发送促销电子邮件。我有包含所有电子邮件列表的 txt 文件。

波纹管是我发送电子邮件的代码,但此代码有时只工作,有时不工作。

文本文件示例:

abc@abc.com
xyz@xyz.com
hello@xyz.com

等等。

该文件存储在根目录中。

现在我的控制器的代码。

$file = fopen("10.txt", "r");
$str = "";
$i = 0;
while (!feof($file)) {
  if($i != 0){ $str .= ","; }else{ $i++;}
  $str .= fgets($file);
}
fclose($file);
$this->load->library('email');
$this->email->clear(TRUE);
$this->email->from('email-id@email.com', 'Name Here');
$this->email->to('email-id@email.com'); 
$this->email->bcc($str); 
$this->email->set_mailtype("html");
$this->email->subject('Subject here');
$message = $this->load->view('email-template', '' , true);  
$this->email->message($message);    
$this->email->send();

你能帮我解决这个问题吗?

4

0 回答 0