电子邮件CSV附件在Outlook 2013中显示为空

时间:2015-01-28 10:15:16

标签: php email cakephp csv outlook

我仅在Outlook 2013中收到了无数据CSV附件电子邮件,但获得了包含gmail和其他邮件数据的CSV。 我使用了以下CakePHP代码:

            $this->Email->reset();
            $fileatt = ROOT . DS . APP_DIR . DS . WEBROOT_DIR . DS;
            $this->Email->to =array('ram@xyz.com');
            $this->Email->cc =array('ram@gmail.com');
            $this->Email->subject = "CSV mail";
            $this->Email->from = "info@gmail.com";
            $this->Email->sendAs = 'html';
            $this->Email->filePaths  = array($fileatt);
            $this->Email->attachments =array("Sample.csv");
            $this->Email->charset = "utf-8";
            $this->Email->headerCharset = "utf-8";
            $message = "Hi Thanks!";
            $this->Email->send($message);

帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

  

您应该在附件中使用此代码

     $Email->attachments(array(
            'Sample.csv' => array(
                'file' => WWW_ROOT.'img/doc/Sample.csv',
                'mimetype' => 'text/csv',
                'contentId' => 'my-unique-id'
            )
         ));