1

有谁知道如何使用带有 iOS 开发工具包的 Amazon SES 发送带有附件的邮件。

4

1 回答 1

2

要使用 iOS 开发工具包通过 SES 发送电子邮件,您需要创建AWSSESSendRawEmailRequest并确保 rawMessage ( AWSSESRawMessage ) 数据格式符合有关电子邮件标头字段、MIME 类型、MIME 编码和 base64 编码的 Internet 电子邮件标准。

这意味着将附件的 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) 属性,因此需要将此字符串转换为 NSData,然后才能在 AWSSESRawMessage 中使用它

于 2016-12-12T10:48:33.263 回答