Skip to content

Vapor 4 support

Compare
Choose a tag to compare
@twof twof released this 21 Jan 19:26
· 27 commits to master since this release
78a756c

Mailgun now supports Vapor 4! Development for Vapor 4 will be done on master from here on out and Vapor 3 development will be done on the vapor3 branch.

import Mailgun

// Called before your application initializes.
func configure(_ app: Application) throws {
    /// case 1
    /// put into your environment variables the following keys:
    /// MAILGUN_API_KEY=...
    app.mailgun.configuration = .environment

    /// case 2
    /// manually
    app.mailgun.configuration = .init(apiKey: "<api key>")
} 
// call it without arguments to use default domain
app.mailgun().send(...)
req.mailgun().send(...)

// or call it with domain
app.mailgun(.myApp1).send(...)
req.mailgun(.myApp1).send(...)