AWS SES使用Amazon iOS SDK发送带有附件的邮件 [英] AWS SES sending mail with attachement using Amazon iOS SDK

查看:238
本文介绍了AWS SES使用Amazon iOS SDK发送带有附件的邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何通过iOS SDK使用Amazon SES发送带有附件的邮件.

解决方案

要使用iOS SDK通过SES发送电子邮件,您需要创建

请注意,AWSSESRawMessage具有数据(NSData)属性,因此在AWSSESRawMessage中使用此字符串之前,需要将该字符串转换为NSData.

Does anyone know how to send a mail with an attachment using Amazon SES with the iOS SDK.

To send an email with SES using the iOS SDK you need to create a AWSSESSendRawEmailRequest and make sure that the rawMessage (AWSSESRawMessage) data format complies with Internet email standards regarding email header fields, MIME types, MIME encoding, and base64 encoding.

This means converting the NSData of your attachment to a base64 string and inserting it in the raw email string with all the headers etc.

Such a string may look something like this:

        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

Note that AWSSESRawMessage has a data (NSData) property so this string will need to be converted to NSData before using it in AWSSESRawMessage

这篇关于AWS SES使用Amazon iOS SDK发送带有附件的邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆