public struct Mail
Represents an email. It contains necessary information like from
, to
and
text
with which Hedwig could send it with a connection to some SMTP server.
The whole type is immutable. You need to create a mail through the initialzer
and then feed it to a Hedwig
instance to send.
-
From name and address.
Declaration
Swift
public let from: NameAddressPair?
-
To names and addresses.
Declaration
Swift
public let to: [NameAddressPair]
-
Carbon copy (Cc) names and addresses.
Declaration
Swift
public let cc: [NameAddressPair]?
-
Blind carbon copy (Bcc) names and addresses.
Declaration
Swift
public let bcc: [NameAddressPair]?
-
The title of current email.
Declaration
Swift
public let subject: String
-
The text content of current email.
Declaration
Swift
public let text: String
-
The attachements contained in the email.
Declaration
Swift
public let attachments: [Attachment]
-
The additional headers will be presented in the mail header.
Declaration
Swift
public let additionalHeaders: [String: String]
-
The alternative attachement. The last alternative attachment in
attachments
will be thealternative
attachement of the wholeMail
.Declaration
Swift
public let alternative: Attachment?
-
Message id. It is a UUID string appeneded by
.Hedwig
.Declaration
Swift
public let messageId = UUID().uuidString + ".Hedwig"
-
Creating date of the mail.
Declaration
Swift
public let date = Date()
-
Initilize an email.
Declaration
Swift
public init(text: String, from: String, to: String, cc: String? = nil, bcc: String? = nil, subject: String = "", attachments: [Attachment]? = nil, additionalHeaders: [String: String] = [:])
Parameters
text
The plain text of the mail.
from
From name and address.
to
To names and addresses.
cc
Carbon copy (Cc) names and addresses. Default is
nil
.bcc
Blind carbon copy (Bcc) names and addresses. Default is
nil
.subject
Subject (title) of the email. Default is empty string.
attachments
Attachements of the mail.
additionalHeaders
Additional headers when sending the mail.