-
The default port is now
587
. -
The
SMTP
struct is now initialized with aTLSMode
enum instead of auseTLS
Bool, allowing more configuration options:
/// TLSMode enum for what form of connection security to enforce.
public enum TLSMode {
/// Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.
case normal
/// Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.
case ignoreTLS
/// Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.
case requireTLS
/// Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.
case requireSTARTTLS
}
User
struct now nested inMail
struct to avoid namespace issues (69). Create a user like so:
let sender = Mail.User(name: "Sloth", email: "[email protected]")
-
User
properties are now public -
The optional
accessToken
parameter of theSMTP
struct has been removed. If you are using the authorization methodXOAUTH2
, pass in your access token in thepassword
parameter instead. For example:
let smtp = SMTP(
hostname: "smtp.gmail.com",
email: "[email protected]",
password: "accessToken",
authMethods: [.xoauth2]
)
- Fixed a bug where the wrong
Attachment
was used an an alternative to text content when aMail
was initialized with multipleAttachment
s (67)
Before 3.0.0
:
public init(hostname: String,
email: String,
password: String,
port: Port = Ports.tls.rawValue,
ssl: SSL? = nil,
authMethods: [AuthMethod] = [],
domainName: String = "localhost",
accessToken: String? = nil,
timeout: UInt = 10)
After 3.0.0
:
public init(hostname: String,
email: String,
password: String,
port: Int32 = 465,
useTLS: Bool = true,
tlsConfiguration: TLSConfiguration? = nil,
authMethods: [AuthMethod] = [],
accessToken: String? = nil,
domainName: String = "localhost",
timeout: UInt = 10)
SSL
renamed toTLSConfiguration
Port
typealias
Mail
properties are now public