I have received No Data CSV attachment email in Outlook 2013 only but got a CSV with data on gmail and other mails. I have used the following CakePHP code:
$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);
Help me to resolve this.
You should use this code in attachments
$Email->attachments(array(
'Sample.csv' => array(
'file' => WWW_ROOT.'img/doc/Sample.csv',
'mimetype' => 'text/csv',
'contentId' => 'my-unique-id'
)
));