ソースを参照

fix decoding of email attachements

euromark 13 年 前
コミット
16ddc5cb4a
2 ファイル変更5 行追加5 行削除
  1. 3 3
      Lib/ImapLib.php
  2. 2 2
      Test/Case/Lib/ImapLibTest.php

+ 3 - 3
Lib/ImapLib.php

@@ -289,7 +289,7 @@ class ImapLib {
 				$data = "";
 				$mege = imap_fetchbody($this->stream, $header->Msgno, $fpos);
 				$attachment['filename'] = $part->dparameters[0]->value;
-				$attachment['data'] = $this->_getDecodedValue($mege, $part->type);
+				$attachment['data'] = $this->_getDecodedValue($mege, $part->encoding);
 				$attachment['filesize'] = strlen($attachment['data']);
 
 				$fpos++;
@@ -306,7 +306,7 @@ class ImapLib {
 				$data = "";
 				$mege = imap_fetchbody($this->stream, $header->Msgno, $fpos);
 				$attachment['filename'] = $part->parameters[0]->value;
-				$attachment['data'] = $this->_getDecodedValue($mege, $part->type);
+				$attachment['data'] = $this->_getDecodedValue($mege, $part->encoding);
 				$attachment['filesize'] = strlen($attachment['data']);
 
 				$fpos++;
@@ -326,7 +326,7 @@ class ImapLib {
 				$data = "";
 				$mege = imap_fetchbody($this->stream, $header->Msgno, $fpos);
 				$attachment['filename'] = !is_object($part->parameters) ? $part->parameters[0]->value : '';
-				$attachment['data'] = $this->_getDecodedValue($mege, $part->type);
+				$attachment['data'] = $this->_getDecodedValue($mege, $part->encoding);
 				$attachment['filesize'] = strlen($attachment['data']);
 
 				$fpos++;

+ 2 - 2
Test/Case/Lib/ImapLibTest.php

@@ -24,7 +24,7 @@ class ImapLibTest extends MyCakeTestCase {
 
 	public function setUp() {
 		$this->skipIf(!function_exists('imap_open'), 'No Imap class installed');
-		$this->skipIf(!Configure::read('Mailbox.DEVTEST'), 'No test account available');
+		$this->skipIf(!Configure::read('Mailbox.DEVTEST'), 'No test account `DEVTEST` available');
 
 		$this->Imap = new ImapLib();
 
@@ -32,7 +32,7 @@ class ImapLibTest extends MyCakeTestCase {
 	}
 
 	public function tearDown() {
-
+		unset($this->Imap);
 	}
 
 	public function testObject() {