SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
SwiftMandrill.xcodeproj
SwiftMandrill.xcworkspace
SwiftMandrill
SwiftMandrillTests
.gitignore
.travis.yml
LICENSE
Podfile
Podfile.lock
README.md
SwiftMandrill.podspec

README.md

SwiftMandrill Build Status codecov.io CocoaPods Compatible GitHub license

SwiftMandrill provides simple alternative when you need to send an email with your iOS app. Why?

Sometimes, there is the need to setup a simple email form in your iOS app, or trigger an email after an action, without having to setup your own service for that, sometimes you don't want to use the MailComposeViewController or use a SMTP library. This provide a simple alternative when you need to send an email with your iOS app.

🐒 Mandrill

Mandrill provides a simple reliable API for transactional emails. You will need to have a Mandrill account to use the client and a API key.

:octocat: Installation

Get SwiftMandrill on CocoaPods, just add pod 'SwiftMandrill' to your Podfile.

🎓 Usage

Usage is very simple

let api = MandrillAPI(ApiKey: "YourApiKey")

api.sendEmail(from:    "from@test.com",
              fromName:"Chris Jimenez",
              to:      "to@test.com",
              subject: "My subject",
              html:    "<b>This is a Test</b>",
              text:    "This is a test"){ mandrillResult in
    if mandrillResult.success {
      print("Email was sent!")
    }
}

You can also send an email to several recipients by passing an array

let api = MandrillAPI(ApiKey: "YourApiKey")

api.sendEmail(from:    "from@test.com",
              fromName:"Chris Jimenez",
              to:      ["to@test.com","to@test2.com"],
              subject: "My subject",
              html:    "<b>This is a Test</b>",
              text:    "This is a test"){ mandrillResult in
    if mandrillResult.success {
      print("Email was sent!")
    }
}

If inline parameters is not your thing you can also provide a MandrillEmail object and send that one

let api = MandrillAPI(ApiKey: "YourApiKey")

let email     = MandrillEmail()
email.from    = "test@test.com"
email.fromName= "Chris Jimenez"
email.to      = "totest@gmail.com"
email.subject = "this is a test"
email.html    = "<b><Test/b>"
email.text    = "Test"   

 api.sendEmail(withEmail: email){ mandrillResult in
    if mandrillResult.success {
      print("Email was sent!"")
    }
}

🔧 TODO

  • Most of the API is still not cover, stuff like tracking, templates, search, etc will be a nice addition.

  • Carthage support

✌️ License

MIT

👽 Author

Chris Jimenez - http://chrisjimenez.net, @chrisjimeneznat