Zend_Mail:如何获取附件ID? [英] Zend_Mail: how to get attachment ID?
本文介绍了Zend_Mail:如何获取附件ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Zend创建电子邮件. 现在,我将内嵌图像放置在邮件的HTML部分中. 因此,我将图像附加到:
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();
最后一条命令用于获取未设置部件ID的标头. 但是,要链接邮件中的图像,我需要附件ID,那么如何获得它?
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);
这篇关于Zend_Mail:如何获取附件ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文