Sending Mailcore2 Plain Emails in Swift

前端 未结 4 1265
醉话见心
醉话见心 2020-12-14 11:38

I\'ve recently incorporated MailCore2 into my Objective-C project, and it has worked perfectly. Now, I am in the process of transitioning the code within the app to Swift. I

4条回答
  •  臣服心动
    2020-12-14 12:05

    To send an image as attachment in swift just add:

        var dataImage: NSData?
        dataImage = UIImageJPEGRepresentation(image, 0.6)!
        var attachment = MCOAttachment()
        attachment.mimeType =  "image/jpg"
        attachment.filename = "image.jpg"
        attachment.data = dataImage
        builder.addAttachment(attachment)
    

提交回复
热议问题