项目作者: bre7

项目描述 :
Unofficial Swift library for Mailgun
高级语言: Swift
项目地址: git://github.com/bre7/mailgun-swift.git
创建时间: 2017-08-15T18:17:04Z
项目社区:https://github.com/bre7/mailgun-swift

开源协议:MIT License

下载


⚠️ Library is not being actively maintained. ⚠️

Unofficial Swift library to interface with Mailgun’s API.

Install using CocoaPods:

  1. pod 'MailgunSwift', :git => 'https://github.com/bre7/mailgun-swift.git', :branch => 'master'

This is just a quick Swift version of their SDK. The API is pretty much the same for now (great & simple example to use a DSL-styled API).

  1. let someImage = UIImage(named: "randomName")!
  2. let message = MailgunMessage(from:"Excited User <someone@sample.org>",
  3. to:"Jay Baird <jay.baird@rackspace.com>",
  4. message:"Mailgun is awesome!",
  5. body:"Mailgun is great, here is a picture of a cat.")
  6. message.add(image: someImage, named: "image01", type: .jpeg)
  7. let mailgun = Mailgun(apiKey: "key-1111111111111", domain: "samples.mailgun.org")
  8. mailgun.send(message: message) { result in
  9. switch result {
  10. case .success(let messageId):
  11. print(messageId)
  12. case .failure(let error):
  13. print(error)
  14. }
  15. }

Why? Mailgun’s objc SDK hasn’t been updated in quite some time and lacks improvements when using Swift (or modern objc) like nullability annotations, etc.

PRs/issues are welcome 😁


TODO:

  • Improved error handling (remove !s)
  • DSL-style API
  • Mailing list APIs (add, remove, check)
  • Linux support
  • Queue operations (work offline)