嘿,我正在使用 Codeigniter 的电子邮件助手,但遇到了一个奇怪的问题。我有以下代码:
$path = mpdf_create_billing($html);
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from('no-reply@foo.com');
$this->email->to("foo@gmail.com");
$this->email->subject('Invoice for '.date('d/m/y'));
$this->email->message($message);
$this->email->attach($path);
if($this->email->send())
echo "Email Sent Successfully to $email with the file $path<br>";
else
echo "Should be sending email to $email , but i didn't<br>";
现在这段代码在一个 foreach 循环中,在这种情况下是两次。mpdf_create_billing
返回 PDF 文件的路径。现在这段代码回显了 2 个不同的文件路径,但电子邮件是相同的,并且在两个循环运行中,两封电子邮件都包含相同的文件,尽管文件路径不同。
任何人都知道如何解决它?这就是我的输出:
Email Sent Successfully to foo@foo.com with the file
/path/to/pdf/Invoice_1368452801.82065190eec1c85eb.pdf
Email Sent Successfully to foo@foo.com with the file
/path/to/pdf/Invoice_1368452804.53475190eec482917.pdf
这可能是我发送电子邮件的 SMTP 服务器的问题吗?我在 2 个邮件帐户上尝试过,结果相同。