Skip to content

Instantly share code, notes, and snippets.

@makzan
Created June 11, 2015 01:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makzan/11e8605f85352abf8dc1 to your computer and use it in GitHub Desktop.
Save makzan/11e8605f85352abf8dc1 to your computer and use it in GitHub Desktop.
Send mail via Mailgun from iOS Swift with Alamofire
let key = "<YOUR-KEY>"
let parameters = [
"from": "<FROM-EMAIL>",
"to": "<TO-EMAIL>",
"subject": "<SUBJECT>",
"text": "<CONTENT>"
]
let r = Alamofirerequest(.POST, "https://api.mailgun.net/v3/<MAILGUN-DOMAIN>/messages", parameters:parameters)
.authenticate(user: "api", password: key)
.response { (request, response, data, error) in
println(request)
println(response)
println(error)
}
debugPrintln(r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment