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
attachmentswill be thealternativeattachement 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
textThe plain text of the mail.
fromFrom name and address.
toTo names and addresses.
ccCarbon copy (Cc) names and addresses. Default is
nil.bccBlind carbon copy (Bcc) names and addresses. Default is
nil.subjectSubject (title) of the email. Default is empty string.
attachmentsAttachements of the mail.
additionalHeadersAdditional headers when sending the mail.
View on GitHub
Install in Dash
Mail Struct Reference