gpt4 book ai didi

ios - AWS SES 使用 Amazon iOS SDK 发送带附件的邮件

转载 作者:搜寻专家 更新时间:2023-11-01 07:17:45 24 4
gpt4 key购买 nike

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

最佳答案

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

这意味着将附件的 NSData 转换为 base64 字符串,并将其与所有 header 等一起插入到原始电子邮件字符串中。

这样的字符串可能看起来像这样:

        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

关于ios - AWS SES 使用 Amazon iOS SDK 发送带附件的邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41095689/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com