AWS SES使用Amazon iOS SDK发送附件

有谁知道如何使用Amazon SES和iOS SDK发送带有附件的邮件。

要使用iOS SDK发送带有SES的电子邮件,您需要创build一个AWSSESSendRawEmailRequest ,并确保rawMessage( AWSSESRawMessage )数据格式符合有关电子邮件标题字段,MIMEtypes,MIME编码和base64编码的Internet电子邮件标准。

这意味着将附件的NSData转换为base64string,并将其插入带有所有标题的原始电子邮件string中

这样的string可能看起来像这样:

From: "Bob" <bob@example.com> To: "Andrew" <andrew@example.com> Date: Wed, 2 Mar 2011 11:39:34 -0800 Subject: Customer service contact info Accept-Language: en-US Content-Language: en-US Content-Type: multipart/mixed; boundary="_003_97DCB304C5294779BEBCFC8357FCC4D2" MIME-Version: 1.0 --_003_97DCB304C5294779BEBCFC8357FCC4D2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Andrew. Here are the customer service names and telephone numbers I promised you. See attached. -Bob --_003_97DCB304C5294779BEBCFC8357FCC4D2 Content-Type: text/plain; name="cust-serv.txt" Content-Description: cust-serv.txt Content-Disposition: attachment; filename="cust-serv.txt"; size=1180; creation-date="Wed, 02 Mar 2011 11:39:39 GMT"; modification-date="Wed, 02 Mar 2011 11:39:39 GMT" Content-Transfer-Encoding: base64 TWFyeSBEYXZpcyAtICgzMjEpIDU1NS03NDY1DQpDYXJsIFRob21hcyAtICgzMjEpIDU1NS01MjM1 DQpTYW0gRmFycmlzIC0gKDMyMSkgNTU1LTIxMzQ= --_003_97DCB304C5294779BEBCFC8357FCC4D2 

请注意,AWSSESRawMessage具有数据(NSData)属性,所以在AWSSESRawMessage中使用它之前,需要将此string转换为NSData

Interesting Posts