我正在使用 Codeigniter 电子邮件类,并在创建发票或其他内容时发送自动电子邮件。我在 Gmail 上收到的电子邮件非常完美,没有重复的附件,但我使用 Exchange 和 Outlook 的客户在电子邮件中收到的一个文件最多有 3 个重复项。这是相关的PHP代码(不过我不认为这是代码问题)
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.1and1.com',
'smtp_port' => 25,
//'smtp_crypto' => 'ssl',
'smtp_user' =>'<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f287819780b29f8b859790819b8697dc919d9f" rel="noreferrer noopener nofollow">[email protected]</a>',
'smtp_pass' => 'password',
'mailtype' => 'html',
'charset' => 'utf-8'
);
$this->load->library('email', $config);
$this->email->clear();
$this->email->set_newline("\r\n");
$this->email->set_crlf( "\r\n" );
$this->email->from('user@mywebsite', 'UserName');
$this->email->to($email);
$this->email->subject($subject);
$this->email->message($msg);
$this->email->attach($attachment);
$this->email->send();
对于为什么会发生这种情况有什么想法吗?我认为这与 Outlook 和 Exchange 服务器有关,因为我的 Gmail 帐户上从未收到重复的邮件
感谢您的浏览
最佳答案
我也遇到了同样的问题。添加 TRUE 明确解决了我的问题。
$this->电子邮件->清除(TRUE);
Codeigniter: Email attachment of last emails not cleared while sending multiple emails in loop
关于php - 发送带有附件的自动电子邮件时,有时文件会重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23569310/