"Fixes #4416, Email component uses invalid \"Content-Type\" for attachments.

Added fclose();
Removed unused code"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6623 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-04-02 18:57:29 +00:00
parent c9a6fa7f9f
commit 358c529e7a

View file

@ -518,14 +518,10 @@ class EmailComponent extends Object{
$handle = fopen($file, 'rb');
$data = fread($handle, filesize($file));
$data = chunk_split(base64_encode($data)) ;
$info = pathinfo($file);
$filetype = 'unknown';
if (isset($info['extension'])) {
$filetype = $info['extension'];
}
fclose($handle);
$this->__message .= '--' . $this->__boundary . $this->_newLine;
$this->__message .= 'Content-Type: ' . $filetype . '; name="' . basename($file) . '"' . $this->_newLine;
$this->__message .= 'Content-Type: application/octet-stream' . $this->_newLine;
$this->__message .= 'Content-Transfer-Encoding: base64' . $this->_newLine;
$this->__message .= 'Content-Disposition: attachment; filename="' . basename($file) . '"' . $this->_newLine . $this->_newLine;
$this->__message .= $data . $this->_newLine . $this->_newLine;