문제

zend_mail 설정을 가져 와서 잘 작동하지만, PDF 첨부 파일의 PNG 이미지는 스크램블링됩니다.

이것은 첨부 파일에 대한 비트입니다.

$filecontents = file_get_contents($attachment);

$att = $this->mail->createAttachment($filecontents);
$att->disposition = 'Zend_Mime::DISPOSITION_INLINE';
$att->encoding = 'Zend_Mime::ENCODING_BASE64';
$att->filename = 'result.pdf';
$att->type = 'application/pdf';
.

PDF는 zend_pdf 로 생성됩니다.

PNG는 다음과 같이 추가됩니다.

$image = Zend_Pdf_Image::imageWithPath("path/to/png.png");
$this->page->drawImage($image, $left, $bottom, $right, $top);
.

아이디어가 있습니까?

미리 감사드립니다!

피터

도움이 되었습니까?

해결책

Do you actually want the PDF to be inline in the email? I don't think email clients even support that. Try Zend_Mime::DISPOSITION_ATTACHMENT.

Also, the constants should not be in quotes. It's just $at->disposition = Zend_Mime::DISPOSITION_ATTACHEMENT.

다른 팁

Why do you set inline disposition for a PDF attachment? The mail client can't display it inline anyway (unlike the GIF in the Zend example).

The PNG format contains a \r\n in its signature, so I'd check for corruption there.. possibly triggered by the disposition:INLINE setting, but perhaps you've enabled some stream wrappers you're not telling us about?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top