如何在iOS swift中使用AWS SES发送自定义格式的电子邮件?

如何在iOS swift中使用AWS SES发送自定义格式的电子邮件?,ios,swift,string,amazon-web-services,email,Ios,Swift,String,Amazon Web Services,Email,我可以用纯文本成功发送原始邮件,但我需要用自定义格式(粗体和普通文本)发送。messageBody数据不接受属性字符串,它只接受字符串。 谢谢。这回答了你的问题吗? let subject = AWSSESContent() subject?.data = "Subject here" subject?.charset = "UTF-8" let messageBody = AWSSESContent() messageBody?.data = &qu

我可以用纯文本成功发送原始邮件,但我需要用自定义格式(粗体和普通文本)发送。messageBody数据不接受属性字符串,它只接受字符串。
谢谢。

这回答了你的问题吗?
let subject = AWSSESContent() 
subject?.data = "Subject here"
subject?.charset = "UTF-8"
let messageBody = AWSSESContent()
messageBody?.data =  "Custom text here"
messageBody?.charset = "UTF-8"
let body = AWSSESBody()
body?.text = messageBody

let theMessage = AWSSESMessage()
theMessage?.subject = subject
theMessage?.body = body

let destination = AWSSESDestination()

destination?.toAddresses = ["Destination@gmail.com"]

let send = AWSSESSendEmailRequest()
send?.source = "source@gmail.com"
send?.destination = destination
send?.message = theMessage

AWSSES.default().sendEmail(send!) { (response:AWSSESSendEmailResponse?, mailError: Error?) in
           
 print(mailError?.localizedDescription as Any)
           
}