                 task.launch()
                 task.waitUntilExit()
                 let _ = try? file.file?.delete()
-                return task.terminationStatus == 0
+                guard task.terminationStatus == 0 else {
+                    return false
+                }
+                EventCenter.defaultCenter().triggerEvent(Events.Sent.self, params: self)
+                return true
             #else
-                var body = """
-                    Subject: \(self.subject)
-                    From: \(self.from)
-                    """
-
-                for (key,value) in self.headers {
-                    body += "\n\(key): \(value)"
-                }
-                body += "\n\(self.body)"
-                let _ = try file.createFile(containing: body.data(using: .utf8), canOverwrite: true)
-                print("Debug mode. See \(file.url.relativePath) for content.")
-                return true
+                return try debug()
             #endif
 
         }

    }

    let id: String
    let subject: String
    let recipient: String
    let from: String
    let body: String
    var headers = [String:String]()

    public init(to: String, subject: String, from: String, replyTo: String? = nil, HTMLBody: String) {
        try! self.init(to: to, subject: subject, from: from) { builder in

import Foundation

public struct Email {
    public static var DebugMode = false

    public struct Events {
        public class Sent: EventType { public typealias CallbackParam = Email }
    }

    public struct Builder {
        let id: String

