Skip to content

Releases: vapor-community/mailgun

Can now attach files

24 Jul 22:50
e5a5dc8
Compare
Choose a tag to compare
router.post("mail") { (req) -> Future<Response> in
    let fm = FileManager.default
    guard let attachmentData = fm.contents(atPath: "/tmp/test.pdf") else {
        throw Abort(.internalServerError)
    }
    let attachment = File(data: attachmentData, filename: "test.pdf")
    let message = Mailgun.Message(
        from: "postmaster@example.com",
        to: "example@gmail.com",
        subject: "Newsletter",
        text: "This is a newsletter",
        html: "<h1>This is a newsletter</h1>",
        attachments: [attachment]
    )
    
    let mailgun = try req.make(Mailgun.self)
    return try mailgun.send(message, on: req)
}

Full API key now required

31 May 17:55
135f522
Compare
Choose a tag to compare

It was pointed out in #11 that some api keys don't begin with key- so the bit prepending key- to every request that didn't include it was breaking.

Full api keys are now required to be used.

Mail can be sent with an application in addition to a request

10 May 17:27
11d300b
Compare
Choose a tag to compare
Merge pull request #8 from vkill/patch-1

Make send work on Application

Bug fix

06 May 19:35
4d1cf72
Compare
Choose a tag to compare

There was an incorrect header that was preventing sending mail

Updated for Vapor 3

05 May 02:30
Compare
Choose a tag to compare

No public api changes, but the primary features of Mailgun are supported now

Add Forwarding Setup

01 May 01:45
Compare
Choose a tag to compare
public func boot(_ app: Application) throws {
    // sets up a catch_all forward for the route listed
    let routeSetup = RouteSetup(forwardURL: "http://example.com/mailgun/all", description: "A route for all emails")
    let mailgunClient = try app.make(Mailgun.self)
    try mailgunClient.setupForwarding(setup: routeSetup, with: app).map { (resp) in
        print(resp)
    }
}

Added IncomingMailgun

01 May 01:18
Compare
Choose a tag to compare

Enables easy decoding of forwarded emails from Mailgun

mailgunGroup.post("all") { (req) -> Future<String> in
    do {
        return try req.content.decode(IncomingMailgun.self).map { (incomingMail) in
            return "Hello"
        }
    } catch {
        throw Abort(HTTPStatus.internalServerError, reason: "Could not decode incoming Mailgun")
    }
}

Cleanup

26 Mar 19:27
Compare
Choose a tag to compare

Removed unnecessary extension on HTTPRequest

NIO changes

22 Mar 07:09
16032dc
Compare
Choose a tag to compare
Merge pull request #2 from twof/nio

Nio