【发布时间】:2014-02-28 04:00:09
【问题描述】:
我在我的网站中使用 zend 邮件来发送邮件。在这封邮件中,我添加了一个图像附件功能。邮件发送成功,但我无法查看收件箱中的图像。他们说不支持的文件格式。
这是我的代码
$attach_path = image path
$transport = new Zend_Mail_Transport_Smtp('sanple', $config);
$mail = new Zend_Mail('UTF-8');
$mail->setBodyHtml($message);
$fileContents = file_get_contents($attach_path);
$at = $mail->createAttachment($fileContents);
$at->type = 'image/jpeg';
$at->filename = 'test.jpg';
$mail->setFrom('customersupport@testing.com', 'customersupport@testing.com');
$mail->addTo('customersupport@testing.com','customersupport@testing.com');
$mail->setSubject($subject);
$mail->send($transport);
如果这里有什么问题,请帮助我
提前致谢。
【问题讨论】:
-
您的文件是 .gif 图片,但 mime 类型是 jpeg,请尝试使用 $at->type = "image/gif"
-
那是我的错误。当我从另一个部分复制时,类型发生了变化。但这对我没有帮助。感谢回复
标签: php zend-framework zend-mail