Thursday, February 10, 2011

Zend_Mail: how to get attachment ID?

Hi,

I am using Zend to create emails. Now I will place an inline image in the HTML Part of the mail. So I am attaching the image with:

$imageContent = file_get_contents(APPLICATION_PATH.'../html/static/img/image.jpg');
$image = $mail->createAttachment($imageContent,
    'image/jpeg',
    Zend_Mime::DISPOSITION_INLINE,
    Zend_Mime::ENCODING_BASE64,
    'image.png');
$imageHeaders = $image->getHeaders();

The last command is for getting the headers, where the part id is not set. But for linking the image in the mail I need the attachment id, so how can you get it?

0 comments:

Post a Comment