Skip to content

Commit

Permalink
Merge pull request #17 from MihaelIsaev/patch-1
Browse files Browse the repository at this point in the history
Implement replyTo
  • Loading branch information
twof authored Sep 12, 2018
2 parents e5a5dc8 + 367fa70 commit 292454b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Sources/Mailgun/Models/Message.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ extension Mailgun {

public let from: String
public let to: String
public let replyTo: String?
public let cc: String?
public let bcc: String?
public let subject: String
public let text: String
public let html: String?
public let attachment: [File]?

public init(from: String, to: String, cc: String? = nil, bcc: String? = nil, subject: String, text: String, html: String? = nil, attachments: [File]? = nil) {
private enum CodingKeys : String, CodingKey {
case from, to, replyTo = "h:Reply-To", cc, bcc, subject, text, html, attachment
}

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) {
self.from = from
self.to = to
self.replyTo = replyTo
self.cc = cc
self.bcc = bcc
self.subject = subject
Expand All @@ -26,9 +32,10 @@ extension Mailgun {
self.attachment = attachments
}

public init(from: String, to: [String], 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) {
self.from = from
self.to = to.joined(separator: ",")
self.replyTo = replyTo
self.cc = cc?.joined(separator: ",")
self.bcc = bcc?.joined(separator: ",")
self.subject = subject
Expand All @@ -37,9 +44,10 @@ extension Mailgun {
self.attachment = attachments
}

public init(from: String, to: [FullEmail], 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) {
self.from = from
self.to = to.stringArray.joined(separator: ",")
self.replyTo = replyTo
self.cc = cc?.stringArray.joined(separator: ",")
self.bcc = bcc?.stringArray.joined(separator: ",")
self.subject = subject
Expand Down

0 comments on commit 292454b

Please sign in to comment.