PHP 使用 Amazon SES 附加外部图像作为附件
PHP attaching an external image as an attachment using Amazon SES
我有一个存储在 Amazon S3 上的图像具有此 URL
然后我使用 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_exists
、is_file
和 is_readable
。
所以你必须在本地有文件。
我有一个存储在 Amazon S3 上的图像具有此 URL
然后我使用 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_exists
、is_file
和 is_readable
。
所以你必须在本地有文件。