Mail

public struct Mail

Represents an email that can be sent through an SMTP instance.

  • A UUID for the mail.

    Declaration

    Swift

    public let uuid: String
  • The User that the Mail will be sent from.

    Declaration

    Swift

    public let from: User
  • to

    Array of Users to send the Mail to.

    Declaration

    Swift

    public let to: [User]
  • cc

    Array of Users to cc. Defaults to none.

    Declaration

    Swift

    public let cc: [User]
  • bcc

    Array of Users to bcc. Defaults to none.

    Declaration

    Swift

    public let bcc: [User]
  • Subject of the Mail. Defaults to none.

    Declaration

    Swift

    public let subject: String
  • Text of the Mail. Defaults to none.

    Declaration

    Swift

    public let text: String
  • Array of Attachments for the Mail. If the Mail has multiple Attachments that are alternatives to plain text, the last one will be used as the alternative (all the Attachments will still be sent). Defaults to none.

    Declaration

    Swift

    public let attachments: [Attachment]
  • Attachment that is an alternative to plain text.

    Declaration

    Swift

    public let alternative: Attachment?
  • Additional headers for the Mail. Header keys are capitalized and duplicate keys will overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION, CONTENT-TRANSFER-ENCODING.

    Declaration

    Swift

    public let additionalHeaders: [String : String]
  • id

    Declaration

    Swift

    public var id: String { get }
  • Hostname from the email address.

    Declaration

    Swift

    public var hostname: String { get }
  • Initializes a Mail object.

    Declaration

    Swift

    public init(from: User,
                to: [User],
                cc: [User] = [],
                bcc: [User] = [],
                subject: String = "",
                text: String = "",
                attachments: [Attachment] = [],
                additionalHeaders: [String: String] = [:])

    Parameters

    from

    The User that the Mail will be sent from.

    to

    Array of Users to send the Mail to.

    cc

    Array of Users to cc. Defaults to none.

    bcc

    Array of Users to bcc. Defaults to none.

    subject

    Subject of the Mail. Defaults to none.

    text

    Text of the Mail. Defaults to none.

    attachments

    Array of Attachments for the Mail. If the Mail has multiple Attachments that are alternatives to plain text, the last one will be used as the alternative (all the Attachments will still be sent). Defaults to none.

    additionalHeaders

    Additional headers for the Mail. Header keys are capitalized and duplicate keys will overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION, CONTENT-TRANSFER-ENCODING.

  • Represents a sender or receiver of an email.

    See more

    Declaration

    Swift

    public struct User