bobqwert718
bobqwert718

Reputation: 21

How do you send an image attachment on an ios app with swift using mailgun?

I was able to send a regular email with a body text using a cocoapod https://cocoapods.org/?q=mailgun But is there a way to send an image attachment?

Upvotes: 1

Views: 337

Answers (1)

nathan
nathan

Reputation: 9395

According to it's SDK (which sadly hasn't been improved for Swift and has a dependency on AFNetworking which is objc):

let message = MGMessage(from:"Excited User <[email protected]>",
                            to:"Jay Baird <[email protected]>",
                            subject:"Mailgun is awesome!",
                            body:"Mailgun is great, here is a picture of a cat.")!
// someImage: UIImage
// type can be either .JPEGFileType or .PNGFileType
message.add(someImage, withName: "image01", type:.PNGFileType)


SwiftMailgun seems like a better fit for Swift but it's still in early stages (Check the TODO list).

Upvotes: 2

Related Questions