https://github.com/pixel16/swiftmandrill
SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
https://github.com/pixel16/swiftmandrill
Last synced: 3 months ago
JSON representation
SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
- Host: GitHub
- URL: https://github.com/pixel16/swiftmandrill
- Owner: PiXeL16
- License: mit
- Created: 2016-01-18T21:27:22.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-08-20T15:22:32.000Z (almost 9 years ago)
- Last Synced: 2025-10-16T01:15:32.047Z (8 months ago)
- Language: Swift
- Homepage:
- Size: 51.8 KB
- Stars: 11
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftMandrill [](https://travis-ci.org/PiXeL16/SwiftMandrill/) [](https://codecov.io/github/PiXeL16/SwiftMandrill?branch=master) [](https://img.shields.io/cocoapods/v/SwiftMandrill.svg) [](https://raw.githubusercontent.com/PiXeL16/SwiftMandrill/master/LICENSE)
SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
:question: 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.
:monkey: Mandrill
----
[Mandrill](https://www.mandrill.com/) 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.
:mortar_board: Usage
-----
Usage is very simple
```swift
let api = MandrillAPI(ApiKey: "YourApiKey")
api.sendEmail(from: "from@test.com",
fromName:"Chris Jimenez",
to: "to@test.com",
subject: "My subject",
html: "This is a Test",
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
```swift
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: "This is a Test",
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
```swift
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 = ""
email.text = "Test"
api.sendEmail(withEmail: email){ mandrillResult in
if mandrillResult.success {
print("Email was sent!"")
}
}
```
:wrench: TODO
-----
* Most of the API is still not cover, stuff like tracking, templates, search, etc will be a nice addition.
* Carthage support
:v: License
-------
MIT
:alien: Author
------
Chris Jimenez - http://chrisjimenez.net, [@chrisjimeneznat](http://twitter.com/chrisjimeneznat)