Zend_Mail: how to get attachment ID?

不想你离开。 提交于 2019-12-06 14:04:02

问题


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?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!