Templates Support
Thanks to @saicu for the implementation!
https://documentation.mailgun.com/en/latest/user_manual.html#templates
Sending templated emails
let message = Mailgun.TemplateMessage(
from: "[email protected]",
to: "[email protected]",
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)