PHP 使用 Amazon SES 将外部图像作为附件附加


PHP attaching an external image as an attachment using Amazon SES

我有一个存储在 Amazon S3 上的图像,具有此 URL

https://s3-eu-west-1.amazonaws.com/xalata-test2/original-jpgs/221094P20151124090355377135V20151123120425503345D20151124104248446R614230518448S10.jpg

然后,我使用 Amazon SES 将此图像附加到使用 Amazon SES(简单电子邮件服务)的电子邮件中。我在这里使用此存储库

https://github.com/daniel-zahariev/php-aws-ses

有关附件的文档指出:

https://github.com/daniel-zahariev/php-aws-ses#attachments

现在,您可以在消息中添加内联文件

$m->addAttachmentFromFile('logo.png','path/to/logo.png','application/octet-stream', '<logo.png>' , 'inline');

这是我尝试过的:

$fileName = 'https://s3-eu-west-1.amazonaws.com/xalata-test2/original-jpgs/221094P20151124090355377135V20151123120425503345D20151124104248446R614230518448S10.jpg';
$m->addAttachmentFromFile('logo.jpg',$fileName,'image/jpeg', 'logo.jpg' , 'inline');

似乎文件必须在服务器上。如何附加外部文件?

> 目前函数addAttachmentFromFile需要一个本地可读文件才能工作,因为它对以下方面进行了一些检查:file_existsis_fileis_readable。因此,您必须在本地拥有该文件。