Skip to content

Releases: vapor-community/mailgun

Mailgun 5.0.0

16 Jul 16:44
cb9e4d6
Compare
Choose a tag to compare

鈿狅笍Breaking changes鈿狅笍
This release of mailgun allows a user to mock MailgunProvider for testing and also uses the correct EventLoop for Request

extension Application.Mailgun.Provider {
    static var fake: Self {
        .init {
            $0.mailgun.use { app, _ in
                MockMailgun(eventLoop: app.eventLoopGroup.next())
            }
        }
    }
}

This release also renames the package name and url to be more concise.
So now installing mailgun will look like

.package(url: "https://github.com/vapor-community/mailgun.git", from: "5.0.0")

.target(name: "App", dependencies: [
    .product(name: "Vapor", package: "vapor"),
    .product(name: "Mailgun", package: "mailgun")
])

Swift 5.2, Vapor 4 RC and Bug Fixes

03 Mar 08:00
9795dbc
Compare
Choose a tag to compare
Merge pull request #39 from MihaelIsaev/master

Fix `IncomingMessage` model and update to Vapor4 RC with Swift 5.2

Vapor 4 support

21 Jan 19:26
78a756c
Compare
Choose a tag to compare

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(...)

Support Multiple Domains

21 Jan 19:23
bd8cf74
Compare
Choose a tag to compare

You can now use multiple domains to send emails with Mailgun

let mailgun = Mailgun(apiKey: "<api key>")
services.register(mailgun, as: Mailgun.self)

// Put this extension at the bottom or create a new file for it
extension Mailgun.DomainConfig {
    static var euDomain: Mailgun.DomainConfig {
        return Mailgun.DomainConfig("mg.example.com", region: .eu)
    }
    static var usDomain: Mailgun.DomainConfig {
        return Mailgun.DomainConfig("mg2.example.com", region: .us)
    }
}
mailgun.send(message, domain: .euDomain, on: req) 

The new major version for this release is 3.0.0 to align with the supported Vapor version. 4.0.0 tag coming soon.

Fix for empty templates

27 Aug 22:39
9c41e74
Compare
Choose a tag to compare

In this release:
#34

Templates Support

03 Aug 16:00
08d8921
Compare
Choose a tag to compare

Thanks to @saicu for the implementation!
https://documentation.mailgun.com/en/latest/user_manual.html#templates

Sending templated emails

let message = Mailgun.TemplateMessage(
    from: "postmaster@example.com",
    to: "example@gmail.com",
    subject: "Newsletter",
    template: "my-template",
    templateData: ["foo": "bar"]
)

let mailgun = try req.make(Mailgun.self)
return try mailgun.send(message, on: req)

Setting up email templates

let template = Mailgun.Template(name: "my-template", description: "api created :)", template: "<h1>Hello {{ name }}</h1>")
    
let mailgun = try req.make(Mailgun.self)
return try mailgun.createTemplate(template, on: req)

EU support

19 Jun 20:31
f9a86d6
Compare
Choose a tag to compare
Merge pull request #31 from madsodgaard/feature/eu-support

Add support for region selection

Added Inline Image Support

10 May 22:20
4270d8e
Compare
Choose a tag to compare

You can now add inline images that will display when the email is rendered. It uses the same format as image attachments.

Breaking API Changes

18 Sep 20:12
353706a
Compare
Choose a tag to compare
Merge pull request #20 from rafiki270/master

readme update for the new code

Now supporting "reply-to" header

12 Sep 23:55
292454b
Compare
Choose a tag to compare
Merge pull request #17 from MihaelIsaev/patch-1

Implement replyTo