5.0.0 Migration Guide
December 9, 2020 ยท View on GitHub
-
The default port is now
587. -
The
SMTPstruct is now initialized with aTLSModeenum instead of auseTLSBool, 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
}
4.0.0 Migration Guide
Userstruct now nested inMailstruct to avoid namespace issues (69). Create a user like so:
let sender = Mail.User(name: "Sloth", email: "sloth@gmail.com")
-
Userproperties are now public -
The optional
accessTokenparameter of theSMTPstruct has been removed. If you are using the authorization methodXOAUTH2, pass in your access token in thepasswordparameter instead. For example:
let smtp = SMTP(
hostname: "smtp.gmail.com",
email: "example@gmail.com",
password: "accessToken",
authMethods: [.xoauth2]
)
- Fixed a bug where the wrong
Attachmentwas used an an alternative to text content when aMailwas initialized with multipleAttachments (67)
3.0.0 Migration Guide
Initialize SMTP
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)
Renamed
SSLrenamed toTLSConfiguration
Removed
Porttypealias
Other Changes
Mailproperties are now public