【问题标题】:PHP attaching an external image as an attachment using Amazon SESPHP 使用 Amazon SES 将外部图像作为附件附加
【发布时间】:2016-03-16 12:45:24
【问题描述】:

我有一个存储在 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');

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

【问题讨论】:

    标签: php amazon-web-services amazon-s3 amazon-ses


    【解决方案1】:

    目前,函数addAttachmentFromFile 需要一个本地可读文件才能工作,因为它会对file_existsis_fileis_readable 进行一些检查。 所以你必须在本地拥有该文件。

    【讨论】:

    • 谢谢。我通过将外部文件复制到我的服务器并在发送电子邮件后清除它们来使用您的解决方案。
    猜你喜欢
    • 1970-01-01
    • 2011-12-19
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    • 2012-05-25
    • 1970-01-01
    相关资源
    最近更新 更多