使用亚马逊 SES 发送带附件的电子邮件

编程入门 行业动态 更新时间:2024-10-11 03:14:57
本文介绍了使用亚马逊 SES 发送带附件的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用亚马逊 SES API 发送包含附件(pdf 文件)的电子邮件.

I am trying to send an email that contains an attachment (a pdf file) using the amazon SES API.

我使用的是 Symfony2,所以我在我的项目中包含了 AmazonWebServiceBundle.我可以使用以下代码轻松发送一封简单的电子邮件(没有附件):

I am using Symfony2 so I included the AmazonWebServiceBundle in my project. I can send a simple email (that has no attachment) pretty easily with the following code:

$ses = $this->container->get('aws_ses'); $recip = array("ToAddresses"=>array("Quilly@yourownpoet")); $message = array("Subject.Data"=>"My Subject","Body.Text.Data"=>"My Mail body"); $result = $ses->send_email("Quilly@yourownpoet",$recip, $message);

不幸的是,要发送带附件的电子邮件,我需要使用 sendRawEmail 函数而不是 send_email 函数.

Unfortunately, to send an email with attachment, i need to use the sendRawEmail function instead of the send_email function.

我无法找到如何使用此功能,有人可以帮忙吗?

I am unable to find how to use this function, could anybody help?

推荐答案

经过多次尝试,我得出的结论是,直接从代码向 Amazon SES 发送电子邮件太痛苦了.

After many tries, I got to the conclusion that sending emails to Amazon SES directly from the code is too much pain.

所以我没有更改代码中的任何内容,而是配置了我的 postfix 服务器.

So I didn't change a thing in the code and configured my postfix server instead.

我遵循了这个程序:docs.amazonwebservices/ses/latest/DeveloperGuide/SMTP.MTA.Postfix.html 并使用 STARTTLS 配置集成.

I followed this procedure: docs.amazonwebservices/ses/latest/DeveloperGuide/SMTP.MTAs.Postfix.html and configured integration using STARTTLS.

我不得不在 Amazon 控制台中询问 SMTP 凭证.

I had to ask for SMTP credentials in the Amazon console.

现在一切正常,电子邮件已通过 Amazon SES 正确发送.

Now it's working fine, emails are sent properly through Amazon SES.

更多推荐

使用亚马逊 SES 发送带附件的电子邮件

本文发布于:2023-11-23 20:09:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1622739.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:亚马逊   附件   电子邮件   SES

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!