本文介绍了使用亚马逊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。我可以轻松地发送一个简单的电子邮件(即没有附件)pretty的有以下code:

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("[email protected]"));
$message = array("Subject.Data"=>"My Subject","Body.Text.Data"=>"My Mail body");
$result = $ses->send_email("[email protected]",$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?

推荐答案

多次尝试后,我得到的结论是,从code发送电子邮件至亚马逊SES直接是太痛了。

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

所以,我并没有改变任何事情,在code和配置我的后缀服务器,而不是。

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

我按照这个程序:的并使用STARTTLS配置的集成。

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

我要问亚马逊控制台SMTP凭据。

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

现在它的正常工作,电子邮件是通过亚马逊SES的发送。

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

这篇关于使用亚马逊SES附件发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-08 11:54