I have the need to send automatic emails in a Swift project I\'m working on. So far my best lead seems to be using Mailgun. (I\'m open to better options if anyone has liked
There's another option that you could try if you wanted as much as possible to be on the Swift side:
If you don't have a bridging header yet, create a dummy objective-c file (add new file to project). Xcode will ask if you will like to add a header file (this will sort out the header for you automatically)
Add this to your bridging header (providing you already imported mail gun using cocoa pods):
#import "mailgun/Mailgun.h"
Import maligun in your swift class:
import mailgun
Simply use mailgun's API in swift as you would in Objective-C:
@IBAction func sendEmail(_ sender: Any) {
let mailgun = Mailgun.client(withDomain: "samples.mailgun.org", apiKey: "key-3ax6xnjp29jd6fds4gc373sgvjxteol0")
mailgun?.sendMessage(to: "Jay Baird ", from: "Excited User ", subject: "Mailgun is awesome!", body: "A unicode snowman for you! ☃")
}