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?
You can set it yourself, see the manual: 36.3. Zend Mime Part, for example:
$this->id = md5($file);
来源:https://stackoverflow.com/questions/1147097/zend-mail-how-to-get-attachment-id