有没有人知道如何使用带有iOS SDK的Amazon SES发送带附件的邮件。
答案 0 :(得分:2)
要使用iOS SDK发送包含SES的电子邮件,您需要创建AWSSESSendRawEmailRequest并确保rawMessage(AWSSESRawMessage)数据格式符合有关电子邮件标题字段的Internet电子邮件标准,MIME类型,MIME编码和base64编码。
这意味着将附件的NSData转换为base64字符串,并将其插入包含所有标题等的原始电子邮件字符串中。
这样的字符串看起来像这样:
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
之前,需要将此字符串转换为NSData。