Skip to content

Commit

Permalink
Merge pull request #29 from AAAstorga/master
Browse files Browse the repository at this point in the history
Add inline support
  • Loading branch information
AAAstorga authored May 10, 2019
2 parents 2f4ae2f + 55d7a13 commit 4270d8e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: ["Mailgun"]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git"),
.package(url: "https://github.com/vapor/vapor.git", from: "3.3.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
12 changes: 8 additions & 4 deletions Sources/Mailgun/Models/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ extension Mailgun {
public let text: String
public let html: String?
public let attachment: [File]?
public let inline: [File]?

private enum CodingKeys : String, CodingKey {
case from, to, replyTo = "h:Reply-To", cc, bcc, subject, text, html, attachment
case from, to, replyTo = "h:Reply-To", cc, bcc, subject, text, html, attachment, inline
}

public init(from: String, to: String, replyTo: String? = nil, cc: String? = nil, bcc: String? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil) {
public init(from: String, to: String, replyTo: String? = nil, cc: String? = nil, bcc: String? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil, inline: [File]? = nil) {
self.from = from
self.to = to
self.replyTo = replyTo
Expand All @@ -30,9 +31,10 @@ extension Mailgun {
self.text = text
self.html = html
self.attachment = attachments
self.inline = inline
}

public init(from: String, to: [String], replyTo: String? = nil, cc: [String]? = nil, bcc: [String]? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil) {
public init(from: String, to: [String], replyTo: String? = nil, cc: [String]? = nil, bcc: [String]? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil, inline: [File]? = nil) {
self.from = from
self.to = to.joined(separator: ",")
self.replyTo = replyTo
Expand All @@ -42,9 +44,10 @@ extension Mailgun {
self.text = text
self.html = html
self.attachment = attachments
self.inline = inline
}

public init(from: String, to: [FullEmail], replyTo: String? = nil, cc: [FullEmail]? = nil, bcc: [FullEmail]? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil) {
public init(from: String, to: [FullEmail], replyTo: String? = nil, cc: [FullEmail]? = nil, bcc: [FullEmail]? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil, inline: [File]? = nil) {
self.from = from
self.to = to.stringArray.joined(separator: ",")
self.replyTo = replyTo
Expand All @@ -54,6 +57,7 @@ extension Mailgun {
self.text = text
self.html = html
self.attachment = attachments
self.inline = inline
}
}
}
Expand Down

0 comments on commit 4270d8e

Please sign in to comment.