2012-12-22 3 views
0

나는 this cakephp 이메일 플러그인을 사용하여 계정에서 이메일을 가져옵니다. 여기 내 매개 변수cakephp 이메일 플러그인 imap으로 이메일을 가져 오기

'datasource' => 'Emails.Imap', 
'server' => 'mail.example.com', 
'connect' => 'imap/novalidate-cert', 
'username' => 'username', 
'password' => 'password', 
'port' => '143', 
'ssl' => false, 
'encoding' => 'UTF-8', 
'error_handler' => 'php', 

가 있으며이 문서

$ticketEmails = $this->TicketEmail->find('first', array('recursive' => -1)); 

에 표시된대로 나는 쿼리를 만들하지만 결과를 디버깅 할 때, 다음 필드는이

Array 
(
    [TicketEmail] => Array 
     (


. . . other fields 

      [body] => CjxIVE1MPjxCT0RZPnNvbWUgbWVzc2FnZTxicj48L0JPRFk+PC9IVE1MPgo= 

      [plainmsg] => IHNvbWUgbWVzc2FnZQo= 

. . . other fields 
     ) 

) 

같은 데이터를 표시 왜 내가이 문자열을 보여줄지 이해할 수 없다. 전자 메일 계정의 메시지 본문에있는 내용은이 텍스트 some message입니다.

내 케이크 버전 1.3

덕분입니다!

답변

1

인코딩이 Base64인데, 플러그인처럼 처리하지 않는 것 같습니다.이 메시지는 checks for the quoted-printable format뿐입니다.

당신에게 Model::afterFind() 콜백 또는 사용자 정의 방법, 예를 들어, 또는 당신이 (안된) 디코딩 된 데이터 반환하도록 플러그인을 수정 시도 할 수, 모델의 decode the data 수 :

protected function _fetchPart ($Part) { 
    $data = imap_fetchbody($this->Stream, $Part->uid, $Part->path, FT_UID | FT_PEEK); 
    if ($data) { 
     // remove the attachment check to decode them too 
     if ($Part->format === 'base64' && $Part->is_attachment === false) { 
      return base64_decode($data); 
     } 
     if ($Part->format === 'quoted-printable') { 
      return quoted_printable_decode($data); 
     } 
    } 
    return $data; 
} 
+0

당신을 매우 감사를 대단히 !! 이제 작동합니다. 나는 그 플러그인이 잘 작동 한 후에 당신의 대답에 몇 가지 추가 사항을 만들었다. 다른 사용자에게 도움이되기를 바랍니다. 다시 한 번 감사드립니다! – dav

관련 문제