54 Commits

Author SHA1 Message Date
Jason Morley 3eaa80f5db Use LoggerAPI debug logging instead of print in DataSender (#140)
This gives users of Swift-SMTP more control over stdout output.
2025-04-02 19:23:19 -07:00
Danny Sung 0501eae561 Update CI (#127)
* Update CI

* Use USE_SWIFT_DEVELOPMENT_SNAPSHOT for development snapshot
2022-02-06 20:02:49 -08:00
Danny Sung 4b7666bb8c Misc dependency update (#125)
* Update dependencies; Swift 5.2 is now the minimum supported version.

* Remove Swift 4.x support

* Bugfix: base64 auth should not have newline; support SSL and non-SSL ports for tests

- base64 encoding auth should not have line length limit
- Tests need to support SSL/TLS and non-SSL ports for mail servers that
  treat them differently

* bugfix: data type for cache

* Update CI: Xcode 13.2; New way to specify development snapshot
2021-12-31 10:05:35 -08:00
Vít Kabele f9b1d704b1 Fix a little RFC5321 syntax unconformance (#117) 2021-03-19 17:39:19 -07:00
Martin Albrecht 697e73a5e3 Fixed issue with HTML attachments (501 Syntax error - line too long) (#114)
* Fixed issue with HTML attachments (501 Syntax error - line too long); Fixed closures

* Fixed issue with HTML attachments (501 Syntax error - line too long); Fixed closures

* Fixed unit tests; Fixed issue with file and data attachments (501 Syntax error - line too long)
2021-01-30 21:31:09 -08:00
Danny Sung d892f67ddb Misc org update (#113)
* Update github org references

* Update jazzy docs

* Updated package references to kitura project versions

* Update package reference for swift 4.x to Kitura org

* Rename deprecated IndexDistance to Int
2020-12-09 09:30:38 -08:00
David Jones 75ba1b9c0f Resolve compilation warnings with Swift 5 and later (#105) 2019-10-04 10:00:07 +01:00
David Jones a24f187755 ci: Update to Swift 5.0.2 2019-08-06 21:29:42 +01:00
David Jones f9e34156c6 ci: Enable xcode11 build 2019-07-17 16:21:31 +01:00
David Jones 35c690956d ci: Remove 5.1 macOS build pending Travis support 2019-07-04 17:23:46 +01:00
David Jones 2725933a65 ci: Update to Swift 5.0.1 2019-04-26 11:47:33 +01:00
Ian Partridge 23360cff5f Merge pull request #99 from IBM-Swift/swift5
Support Swift 5
2019-04-10 17:00:40 +01:00
Ian Partridge beed3112da Support Swift 5 2019-04-10 16:34:33 +01:00
David Jones 3f2a7b5c45 Build against Swift 5 (#93)
* Add Swift 5 builds using SWIFT_DEVELOPMENT_SNAPSHOT
* Update to Swift 4.2.3 and official Docker images
2019-04-01 11:57:18 +01:00
David Jones 99b56a8c86 Update to swift 4.2.1, test on 16.04 / 18.04 (#92) 2018-11-15 16:31:51 +00:00
Quan Vo a34267c2a3 Merge pull request #89 from IBM-Swift/travis-swift-4.2
add swift 4.2 builds to the CI
2018-07-31 12:11:42 -05:00
Quan Vo 6ce4e31e68 Update .travis.yml 2018-07-31 11:19:06 -05:00
Quan Vo b924fdd720 Update .travis.yml 2018-07-31 10:54:42 -05:00
Quan Vo ea7345ca02 Update .travis.yml 2018-07-31 10:26:05 -05:00
Quan Vo 51c1bc2093 Update .travis.yml 2018-07-31 10:25:18 -05:00
Pushkar N Kulkarni 3eb07d4750 add swift 4.2 builds to the CI 2018-07-10 08:15:18 +00:00
Quan Vo 1b58530701 add install instructions to readme 2018-07-06 10:37:04 -05:00
Quan Vo 496f779a07 Merge pull request #85 from pushkarnk/upgrade-4.1.2
Upgrade to Swift 4.1.2
2018-07-03 10:29:24 -05:00
Pushkar Kulkarni 08e0bd81ea Upgrade to Swift 4.1.2 2018-07-03 11:14:22 +05:30
Quan Vo 77ebc1dfd8 Merge pull request #83 from IBM-Swift/starttls2
Starttls2
2018-06-26 12:13:14 -05:00
Quan Vo ec3fa120e5 Starttls merge (#81)
* Adds STARTTLS support

* Adds TLSMode enum to support various tls and unencrypted modes. Change default SMTP init to require STARTTLS and port 587

* Improve comments and names

* fix tests

* fix tests, update readme/migration, regen jazzy

* add tests to LinuxMain
2018-06-26 12:08:06 -05:00
Quan Vo dbce8d5319 add tests to LinuxMain 2018-06-26 11:25:01 -05:00
Quan Vo b0c2a4c1f4 fix tests, update readme/migration, regen jazzy 2018-06-26 11:17:52 -05:00
Quan Vo 979acff232 fix tests 2018-06-26 10:27:10 -05:00
Eric Thorpe eb67bd618c Improve comments and names 2018-06-26 14:27:38 +10:00
Eric Thorpe 737bd39423 Adds TLSMode enum to support various tls and unencrypted modes. Change default SMTP init to require STARTTLS and port 587 2018-06-21 21:40:33 -07:00
Eric Thorpe 15af9fd9b0 Adds STARTTLS support 2018-06-20 01:27:58 -07:00
Quan Vo 54fbbb90df Update dependencies (#76)
* Finished conversion to Swift 4

* Updated travis
2018-05-01 08:54:23 -05:00
Quan Vo b6ca1eaf6f update bluecryptor to 1.0.2. add swift 4.1 support (#73)
* update bluecryptor to 1.0.2. add swift 4.1 support

* loosen spm versioning

* linux swift build failure

* linux

* linux

* linux

* linux

* update docs and regen jazzy
2018-04-30 13:42:43 -05:00
Quan Vo 3958929e16 Merge pull request #72 from IBM-Swift/alternative-attachment
Alternative attachment
2018-04-30 08:41:43 -05:00
Quan Vo 64bcdee9d5 Merge branch 'master' into alternative-attachment 2018-04-30 07:44:10 -05:00
Quan Vo c6349a40ce use last alternative attachment in attachments array 2018-04-30 07:43:10 -05:00
Quan Vo 56faca1e20 Merge pull request #68 from IBM-Swift/fix-namespace
Nest User under Mail
2018-04-25 11:48:40 -05:00
Hans Kröner 38b59b6979 Fix getting alternative attachment
Mail's 'getAlternative(_)' was looking for alternative attachments by
counting from the back of the attachments array. The index was then used
to remove the attachment by counting from the front of the array. This
resulted in the wrong attachment being returned as the 'alternative'
one.
2018-04-25 08:13:54 +02:00
Quan Vo f19bbdd632 update readme and migration guide 2018-04-24 14:25:20 -05:00
Quan Vo 9ae5aa4837 Merge remote-tracking branch 'origin/fix-namespace' into fix-namespace 2018-04-24 13:58:48 -05:00
Quan Vo 0b2e1b1156 Update README.md 2018-04-24 07:01:24 -05:00
Ondrej Rafaj bd65a508af fixing namespace issue 2018-04-23 23:19:55 +01:00
Quan Vo 7bdf6e2796 use access token as password when using xoauth2 (#66)
* improve AuthMethod enum

* use access token as password when using xoauth2

* fix lint
2018-04-23 15:54:15 -05:00
Quan Vo b91c8e2cbb Update README.md 2018-04-06 12:45:00 -05:00
Quan Vo 55679ee569 Create migration-guide.md 2018-04-05 20:51:17 -05:00
Quan Vo e44a3fa946 Specify TLS (#63)
* add migration guide

* fix migration guide link

* regen jazzy

* fix linux

* fix linux
2018-04-05 20:45:36 -05:00
Quan Vo 780246c7c9 Merge pull request #61 from IBM-Swift/plain-text
Use 'text/plain' for plain text content
2018-03-27 13:17:30 -05:00
Quan Vo 79109bb764 update tests 2018-03-27 11:16:29 -05:00
Hans Kröner 2709ff59f4 Use 'text/plain' for plain text content
The previous usage of 'text/html' causes some mail clients (notably
Outlook.com) to incorrectly render the plain text content as if it was
the attached HTML content (if one is present).
2018-03-24 15:53:54 +01:00
Quan Vo d6e90c00c0 Swift 4 davidde94 (#58)
* Finished conversion to Swift 4

* Updated travis

* commit

* use new travis env vars for auth

* remove old credentials repo from travis

* use Swift 4.0.3

* test

* swift 4 changes from davidde94
2018-02-16 01:11:35 -06:00
Trevör Anne Denise 094e4b2748 Update README.md (#56)
Correct the init label
2018-01-22 09:15:27 -06:00
Quan Vo c7a579b94b Update README.md 2017-10-05 10:54:30 -05:00
Quan Vo cd0e6d89f8 Swift4 (#53)
* Add Swift 4 support

* add swift 4 support

* change swift version
2017-10-04 17:12:55 -05:00
81 changed files with 5010 additions and 3645 deletions
+2 -1
View File
@@ -3,4 +3,5 @@
build
/Packages
Package.resolved
/*.xcodeproj
/*.xcodeproj
.swiftpm
+3 -3
View File
@@ -1,6 +1,6 @@
module: SwiftSMTP
author: IBM
github_url: https://github.com/IBM-Swift/Swift-SMTP/
author: IBM and Kitura project contributors
github_url: https://github.com/Kitura/Swift-SMTP/
theme: fullwidth
clean: true
@@ -11,4 +11,4 @@ readme: README.md
skip_undocumented: false
hide_documentation_coverage: false
xcodebuild_arguments: [-project, SwiftSMTP.xcodeproj, -target, SwiftSMTP, LIBRARY_SEARCH_PATHS=.build/debug]
xcodebuild_arguments: []
+1 -1
View File
@@ -1 +1 @@
3.1.1
5.1
+24 -9
View File
@@ -1,28 +1,43 @@
# Travis CI build file.
# whitelist (branches that should be built)
branches:
only:
- master
- /^issue.*$/
# the matrix of builds should cover each combination of Swift version
# and platform that is supported. The version of Swift used is specified
# by .swift-version, unless SWIFT_SNAPSHOT is specified.
matrix:
include:
- os: linux
dist: trusty
dist: bionic
sudo: required
services: docker
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu18.04:5.2.5 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
- os: linux
dist: trusty
dist: focal
sudo: required
env: SWIFT_SNAPSHOT=$SWIFT_4_DEV_SNAPSHOT
services: docker
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu20.04:5.4 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
- os: linux
dist: focal
sudo: required
services: docker
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu20.04:latest USE_SWIFT_DEVELOPMENT_SNAPSHOT=1 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
- os: osx
osx_image: xcode8.3
osx_image: xcode12.2
sudo: required
env: JAZZY_ELIGIBLE=true
- os: osx
osx_image: xcode9
osx_image: xcode13.2
sudo: required
env: SWIFT_SNAPSHOT=$SWIFT_4_DEV_SNAPSHOT
env: USE_SWIFT_DEVELOPMENT_SNAPSHOT=1
before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
- git clone https://$GITHUB_USER:$GITHUB_PWD@github.com/IBM-Swift/Kitura-TestingCredentials.git
- git clone https://github.com/Kitura/Package-Builder.git
script:
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR -credentialsDir $TRAVIS_BUILD_DIR/Kitura-TestingCredentials/Swift-SMTP
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
-5
View File
@@ -1,5 +0,0 @@
{
"autoPin": false,
"pins": [],
"version": 1
}
+20 -9
View File
@@ -1,15 +1,26 @@
// swift-tools-version:5.0
import PackageDescription
#if os(Linux) && !swift(>=3.1.1)
fatalError("Please use Swift >=3.1.1.")
#else
let package = Package(
name: "SwiftSMTP",
products: [
.library(
name: "SwiftSMTP",
targets: ["SwiftSMTP"]),
],
dependencies: [
.Package(url: "https://github.com/IBM-Swift/BlueSocket.git", majorVersion: 0, minor: 12),
.Package(url: "https://github.com/IBM-Swift/BlueSSLService.git", majorVersion: 0, minor: 12),
.Package(url: "https://github.com/IBM-Swift/BlueCryptor.git", majorVersion: 0, minor: 8),
.Package(url: "https://github.com/IBM-Swift/LoggerAPI.git", majorVersion: 1, minor: 7)
]
.package(url: "https://github.com/Kitura/BlueSocket.git", from: "2.0.2"),
.package(url: "https://github.com/Kitura/BlueSSLService.git", from: "2.0.1"),
.package(url: "https://github.com/Kitura/BlueCryptor.git", from: "2.0.1"),
.package(url: "https://github.com/Kitura/LoggerAPI.git", from: "1.9.200"),
],
targets: [
.target(
name: "SwiftSMTP",
dependencies: ["Socket", "SSLService", "Cryptor", "LoggerAPI"]),
.testTarget(
name: "SwiftSMTPTests",
dependencies: ["SwiftSMTP"]),
]
)
#endif
+115 -52
View File
@@ -1,62 +1,112 @@
# Swift-SMTP
![Swift-SMTP bird](https://github.com/IBM-Swift/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png)
![Swift-SMTP bird](https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true)
Swift package for sending emails to an SMTP server.
Swift SMTP client.
[![Build Status](https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master)](https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master)
![Build Status](https://travis-ci.org/Kitura/Swift-SMTP.svg?branch=master)
![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)
![Linux](https://img.shields.io/badge/os-linux-green.svg?style=flat)
![Apache 2](https://img.shields.io/badge/license-Apache2-blue.svg?style=flat)
## Features
- Connect securely through SSL/TLS when available
- Connect securely through SSL/TLS when needed
- Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2
- Send emails with local file, HTML, and raw data attachments
- Add custom headers
- [Documentation](https://ibm-swift.github.io/Swift-SMTP/)
- [Demo & blog post](https://developer.ibm.com/swift/2017/05/31/4675/)
- [Documentation](https://kitura.github.io/Swift-SMTP/)
## Swift Version
macOS & Linux: `Swift 3.1.1`
macOS & Linux: `Swift 5.2` or above.
## Installation
You can add `SwiftSMTP` to your project using [Swift Package Manager](https://swift.org/package-manager/). If your project does not have a `Package.swift` file, create one by running `swift package init` in the root directory of your project. Then open `Package.swift` and add `SwiftSMTP` as a dependency. Be sure to add it to your desired targets as well:
```swift
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "MyProject",
products: [
.library(
name: "MyProject",
targets: ["MyProject"]),
],
dependencies: [
.package(url: "https://github.com/Kitura/Swift-SMTP", .upToNextMinor(from: "5.1.0")), // add the dependency
],
targets: [
.target(
name: "MyProject",
dependencies: ["SwiftSMTP"]), // add targets
.testTarget( // note "SwiftSMTP" (NO HYPHEN)
name: "MyProjectTests",
dependencies: ["MyProject"]),
]
)
```
After adding the dependency and saving, run `swift package generate-xcodeproj` in the root directory of your project. This will fetch dependencies and create an Xcode project which you can open and begin editing.
## Migration Guide
Version `5.0.0` brings breaking changes. See the quick migration guide [here](https://github.com/Kitura/Swift-SMTP/blob/master/migration-guide.md).
## Usage
Use the `SMTP` struct as a handle to your SMTP server:
Initialize an `SMTP` instance:
```swift
import SwiftSMTP
// Create your `SMTP` handle
let smtp = SMTP(hostname: "smtp.gmail.com", // SMTP server address
user: "user@gmail.com", // username to login
password: "password") // password to login
/* Additional parameters available to further customize your `SMTP` handle */
let smtp = SMTP(
hostname: "smtp.gmail.com", // SMTP server address
email: "user@gmail.com", // username to login
password: "password" // password to login
)
```
### SSL
### TLS
If required, `Swift-SMTP` automatically upgrades your connection to an SSL connection. By default, this uses no backing certificates. View docs on the [SSL](https://ibm-swift.github.io/Swift-SMTP/Structs/SSL.html) struct to see how to customize this.
Additional parameters of `SMTP` struct:
```swift
public init(hostname: String,
email: String,
password: String,
port: Int32 = 587,
tlsMode: TLSMode = .requireSTARTTLS,
tlsConfiguration: TLSConfiguration? = nil,
authMethods: [AuthMethod] = [],
domainName: String = "localhost",
timeout: UInt = 10)
```
By default, the `SMTP` struct connects on port `587` and sends mail only if a TLS connection can be established. It also uses a `TLSConfiguration` that uses no backing certificates. View the [docs](https://kitura.github.io/Swift-SMTP/) for more configuration options.
### Send email
Create a `Mail` object and use your `smtp` handle to send it. To set the sender and receiver of an email, use the `User` struct:
Create a `Mail` object and use your `SMTP` handle to send it. To set the sender and receiver of an email, use the `User` struct:
```swift
let drLight = User(name: "Dr. Light", email: "drlight@gmail.com")
let megaman = User(name: "Megaman", email: "megaman@gmail.com")
let drLight = Mail.User(name: "Dr. Light", email: "drlight@gmail.com")
let megaman = Mail.User(name: "Megaman", email: "megaman@gmail.com")
let mail = Mail(from: drLight,
to: [megaman],
subject: "Humans and robots living together in harmony and equality.",
text: "That was my ultimate wish.")
let mail = Mail(
from: drLight,
to: [megaman],
subject: "Humans and robots living together in harmony and equality.",
text: "That was my ultimate wish."
)
smtp.send(mail) { (err) in
if let err = err {
print(err)
smtp.send(mail) { (error) in
if let error = error {
print(error)
}
}
```
@@ -64,45 +114,58 @@ smtp.send(mail) { (err) in
Add Cc and Bcc:
```swift
let roll = User(name: "Roll", email: "roll@gmail.com")
let zero = User(name: "Zero", email: "zero@gmail.com")
let roll = Mail.User(name: "Roll", email: "roll@gmail.com")
let zero = Mail.User(name: "Zero", email: "zero@gmail.com")
let mail = Mail(from: drLight,
to: [megaman],
cc: [roll],
bcc: [zero],
subject: "Robots should be used for the betterment of mankind.",
text: "Any other use would be...unethical.")
let mail = Mail(
from: drLight,
to: [megaman],
cc: [roll],
bcc: [zero],
subject: "Robots should be used for the betterment of mankind.",
text: "Any other use would be...unethical."
)
smtp.send(mail)
```
### Send attachments
Create an `Attachment`, attach it to your `Mail`, and send it through the `smtp` handle. Here's an example of how you can send the three supported types of attachments--a local file, HTML, and raw data:
Create an `Attachment`, attach it to your `Mail`, and send it through the `SMTP` handle. Here's an example of how you can send the three supported types of attachments--a local file, HTML, and raw data:
```swift
// Create a file `Attachment`
let fileAttachment = Attachment(filePath: "~/img.png",
// You can add "CONTENT-ID" to reference this in another attachment
additionalHeaders: ["CONTENT-ID": "img001"])
let fileAttachment = Attachment(
filePath: "~/img.png",
// "CONTENT-ID" lets you reference this in another attachment
additionalHeaders: ["CONTENT-ID": "img001"]
)
// Create an HTML `Attachment`
let htmlAttachment = Attachment(htmlContent: "<html>Here's an image: <img src=\"cid:img001\"/></html>",
related: [fileAttachment]) // to reference `fileAttachment`
let htmlAttachment = Attachment(
htmlContent: "<html>Here's an image: <img src=\"cid:img001\"/></html>",
// To reference `fileAttachment`
related: [fileAttachment]
)
// Create a data `Attachment`
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
let dataAttachment = Attachment(data: data,
mime: "application/json",
name: "file.json",
inline: false) // send as a standalone attachment
let dataAttachment = Attachment(
data: data,
mime: "application/json",
name: "file.json",
// send as a standalone attachment
inline: false
)
// Create a `Mail` and include the `Attachment`s
let mail = Mail(from: from,
to: [to],
subject: "Check out this image and JSON file!",
attachments: [htmlAttachment, dataAttachment]) // attachments we created earlier
let mail = Mail(
from: from,
to: [to],
subject: "Check out this image and JSON file!",
// The attachments we created earlier
attachments: [htmlAttachment, dataAttachment]
)
// Send the mail
smtp.send(mail)
@@ -116,12 +179,12 @@ smtp.send(mail)
let mail1: Mail = //...
let mail2: Mail = //...
smtp.send([mail1, mail2],
smtp.send([mail1, mail2],
// This optional callback gets called after each `Mail` is sent.
// `mail` is the attempted `Mail`, `error` is the error if one occured.
progress: { (mail, error) in
},
// This optional callback gets called after all the mails have been sent.
// `sent` is an array of the successfully sent `Mail`s.
// `failed` is an array of (Mail, Error)--the failed `Mail`s and their corresponding errors.
@@ -132,8 +195,8 @@ smtp.send([mail1, mail2],
## Acknowledgements
`Swift-SMTP` was inspired by [Hedwig](https://github.com/onevcat/Hedwig) and [Perfect-SMTP](https://github.com/PerfectlySoft/Perfect-SMTP), two Swift packages that can also be used to send emails to an SMTP server.
Inspired by [Hedwig](https://github.com/onevcat/Hedwig) and [Perfect-SMTP](https://github.com/PerfectlySoft/Perfect-SMTP).
## License
Apache 2.0
Apache v2.0
-194
View File
@@ -1,194 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
#if os(Linux)
import Dispatch
#endif
enum LoginResult {
case success(SMTPSocket)
case failure(Error)
}
typealias LoginCallback = ((LoginResult) -> Void)
class Login {
fileprivate let hostname: String
fileprivate let email: String
fileprivate let password: String
fileprivate let port: Port
fileprivate let ssl: SSL?
fileprivate let authMethods: [AuthMethod]
fileprivate let domainName: String
fileprivate let accessToken: String?
fileprivate let timeout: UInt
fileprivate var callback: LoginCallback
fileprivate var socket: SMTPSocket
init(hostname: String,
email: String,
password: String,
port: Port,
ssl: SSL?,
authMethods: [AuthMethod],
domainName: String,
accessToken: String?,
timeout: UInt,
callback: @escaping LoginCallback) throws {
self.hostname = hostname
self.email = email
self.password = password
self.port = port
self.ssl = ssl
self.authMethods = authMethods
self.domainName = domainName
self.accessToken = accessToken
self.timeout = timeout * 1000
self.callback = callback
socket = try SMTPSocket()
}
func login() {
do {
try connect(port)
try loginToServer()
callback(.success(socket))
} catch {
callback(.failure(error))
}
}
}
private extension Login {
func connect(_ port: Port) throws {
try socket.connect(to: hostname, port: port, timeout: timeout)
try SMTPSocket.parseResponses(try socket.readFromSocket(), command: .connect)
}
func loginToServer() throws {
var serverInfo = try getServerInfo()
if doesStarttls(serverInfo) {
try starttls(ssl)
try connect(Ports.ssl.rawValue)
serverInfo = try getServerInfo()
}
switch try getAuthMethod(serverInfo) {
case .cramMD5: try loginCramMD5()
case .login: try loginLogin()
case .plain: try loginPlain()
case .xoauth2: try loginXOAuth2()
}
}
func getServerInfo() throws -> [Response] {
do {
return try ehlo()
} catch {
return try helo()
}
}
func doesStarttls(_ serverInfo: [Response]) -> Bool {
return serverInfo.contains { $0.message.contains("STARTTLS") }
}
func starttls(_ ssl: SSL?) throws {
try starttls()
socket.close()
socket = try SMTPSocket()
if let ssl = ssl {
socket.setDelegate(try ssl.makeSSLService())
} else {
socket.setDelegate(try SSL().makeSSLService())
}
}
func getAuthMethod(_ serverInfo: [Response]) throws -> AuthMethod {
for res in serverInfo {
let resArr = res.message.components(separatedBy: " ")
if resArr.first == "AUTH" {
let args = resArr.dropFirst()
for arg in args {
if let authMethod = AuthMethod(rawValue: arg), authMethods.contains(authMethod) {
return authMethod
}
}
}
}
throw SMTPError(.noSupportedAuthMethods(hostname: hostname))
}
}
private extension Login {
func loginCramMD5() throws {
let challenge = try auth(authMethod: .cramMD5, credentials: nil).message
try authPassword(try AuthEncoder.cramMD5(challenge: challenge, user: email, password: password))
}
func loginLogin() throws {
try auth(authMethod: .login, credentials: nil)
let credentials = AuthEncoder.login(user: email, password: password)
try authUser(credentials.encodedUser)
try authPassword(credentials.encodedPassword)
}
func loginPlain() throws {
try auth(authMethod: .plain,
credentials: AuthEncoder.plain(user: email, password: password))
}
func loginXOAuth2() throws {
guard let accessToken = accessToken else {
throw SMTPError(.noAccessToken)
}
try auth(authMethod: .xoauth2, credentials: AuthEncoder.xoauth2(user: email, accessToken: accessToken))
}
}
private extension Login {
func ehlo() throws -> [Response] {
return try socket.send(.ehlo(domainName))
}
func helo() throws -> [Response] {
return try socket.send(.helo(domainName))
}
func starttls() throws {
try socket.send(.starttls)
}
@discardableResult
func auth(authMethod: AuthMethod, credentials: String?) throws -> Response {
let response = try socket.send(.auth(authMethod, credentials))
guard response.count == 1 else {
throw SMTPError(.badResponse(command: "AUTH", response: response.description))
}
return response[0]
}
func authUser(_ user: String) throws {
try socket.send(.authUser(user))
}
func authPassword(_ password: String) throws {
try socket.send(.authPassword(password))
}
}
-185
View File
@@ -1,185 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Port to connect to SMTP server with.
public typealias Port = Int32
/// Common `Port`s.
public enum Ports: Port {
/// Default `Port`.
case tls = 587
/// `Port` used to connect securely.
case ssl = 465
}
/// Supported authentication methods for logging into the SMTP server.
public enum AuthMethod: String {
/// CRAM-MD5 authentication.
case cramMD5 = "CRAM-MD5"
/// LOGIN authentication.
case login = "LOGIN"
/// PLAIN authentication.
case plain = "PLAIN"
/// XOAUTH2 authentication. Requires a valid access token.
case xoauth2 = "XOAUTH2"
}
/// Represents a handle to connect to and send emails to an SMTP server.
public struct SMTP {
private let hostname: String
private let email: String
private let password: String
private let port: Port
private let ssl: SSL?
private let authMethods: [AuthMethod]
private let domainName: String
private let accessToken: String?
private let timeout: UInt
/// Initializes an `SMTP` instance.
///
/// - Parameters:
/// - hostname: Hostname of the SMTP server to connect to. Should not
/// include any scheme--ie `smtp.example.com` is valid.
/// - user: Username to log in to server.
/// - password: Password to log in to server.
/// - port: `Port` to connect to the server on. Defaults to `587`.
/// - ssl: `SSL` containing configuration info for connecting securely
/// through SSL/TLS. If your server has the option to use SSL,
/// Swift-SMTP will automatically attempt to upgrade the
/// connection. If you don't provide an SSL configuration,
/// Swift-SMTP defaults to an SSL configuration with no backing
/// certificates. See `SSL` for other configuration options.
/// - authMethods: `AuthMethod`s to use to log in to the
/// server. Defaults to `CRAM-MD5`, `LOGIN`, and `PLAIN`.
/// - domainName: Client domain name used when communicating with the
/// server. Defaults to `localhost`.
/// - accessToken: Access token used if logging in through `XOAUTH2`.
/// (optional)
/// - timeout: How long to try connecting to the server to before
/// returning an error. Defaults to `10` seconds.
///
/// - Note:
/// - Some servers like Gmail support IPv6, and if your network does
/// not, you will first attempt to connect via IPv6, then timeout, and
/// fall back to IPv4. You can avoid this by disabling IPv6 on your
/// machine.
///
/// - You may need to enable access for less secure apps in your account
/// on the SMTP server.
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) {
self.hostname = hostname
self.email = email
self.password = password
self.port = port
self.ssl = ssl
if !authMethods.isEmpty {
self.authMethods = authMethods
} else {
self.authMethods = [AuthMethod.cramMD5,
AuthMethod.login,
AuthMethod.plain]
}
self.domainName = domainName
self.accessToken = accessToken
self.timeout = timeout
}
/// Send an email.
///
/// - Parameters:
/// - mail: `Mail` object to send.
/// - completion: Callback when sending finishes. `Error` is nil on
/// success. (optional)
public func send(_ mail: Mail, completion: ((Error?) -> Void)? = nil) {
send([mail]) { (_, failed) in
if let error = failed.first?.1 {
completion?(error)
} else {
completion?(nil)
}
}
}
/// Send multiple emails.
///
/// - Parameters:
/// - mails: Array of `Mail`s to send.
/// - progress: (`Mail`, `Error`) callback after each `Mail` is sent.
/// `Mail` is the `Mail` sent and `Error` is the error if it
/// failed. (optional)
/// - completion: ([`Mail`], [(`Mail`, `Error`)]) callback after all
/// `Mail`s have been attempted. [`Mail`] is an array of
/// successfully sent `Mail`s. [(`Mail`, `Error`)] is an
/// array of failed `Mail`s and their corresponding
/// `Error`s. (optional)
///
/// - Note:
/// - If any of the emails addresses in a `Mail`'s `to`, `cc`, or `bcc`
/// are invalid, the entire mail will not send and return an
/// `SMTPError`.
///
/// - If an individual `Mail` fails while sending an array of `Mail`s,
/// the whole sending process will not stop until all pending `Mail`s
/// are attempted.
///
/// - Each call to `send` queues it's `Mail`s and sends them one by one.
/// To send `Mail`s concurrently, send them in separate calls to
/// `send`.
public func send(_ mails: [Mail],
progress: Progress = nil,
completion: Completion = nil) {
if mails.isEmpty {
completion?([], [])
return
}
do {
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: ssl,
authMethods: authMethods,
domainName: domainName,
accessToken: accessToken,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(let error):
completion?([], mails.map { ($0, error) })
case .success(let socket):
Sender(socket: socket,
pending: mails,
progress: progress,
completion: completion).send()
}
}.login()
} catch {
completion?([], mails.map { ($0, error) })
}
}
}
-129
View File
@@ -1,129 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
import Socket
import LoggerAPI
// Wrapper around BlueSocket
struct SMTPSocket {
// The socket we use to read and write to
fileprivate let socket: Socket
// Init a new instance of SMTPSocket
init() throws {
socket = try Socket.create()
}
// Connect to the SMTP server at `port`
func connect(to: String, port: Port, timeout: UInt) throws {
try socket.connect(to: to, port: port, timeout: timeout)
}
// Set the socket's `SSLServiceDelegate` for SSL connections
func setDelegate(_ delegate: SSLServiceDelegate?) {
socket.delegate = delegate
}
// Close the socket
func close() {
socket.close()
}
}
extension SMTPSocket {
// Send the `command` to the server
// Read the response from the server out of the socket
// Parse the server's response for the appropriate responses
// Create `Response`s out of those parsed responses and return them
// Throws an error if no/invalid response found
// Valid responses are `command` specific
@discardableResult
func send(_ command: Command) throws -> [Response] {
try write(command.text)
return try SMTPSocket.parseResponses(try readFromSocket(), command: command)
}
}
extension SMTPSocket {
// Write `text` to the socket
func write(_ text: String) throws {
_ = try socket.write(from: text + CRLF)
Log.debug(text)
}
// Write `data` to the socket
func write(_ data: Data) throws {
_ = try socket.write(from: data)
Log.debug("(sending data)")
}
}
extension SMTPSocket {
// Read all the data out of the socket
// Returns a string representation of the data
// The string could be one or more responses
// Throws an error if a string could not be created from the data
func readFromSocket() throws -> String {
var buf = Data()
_ = try socket.read(into: &buf)
guard let responses = String(data: buf, encoding: .utf8) else {
throw SMTPError(.convertDataUTF8Fail(data: buf))
}
Log.debug(responses)
return responses
}
// Parses through each response and creates a `Response` from it
// Returns an array of these `Response`s
// Throws an error if no/invalid response found
@discardableResult
static func parseResponses(_ responses: String, command: Command) throws -> [Response] {
let resArr = responses.components(separatedBy: CRLF)
guard !resArr.isEmpty else {
throw SMTPError(.badResponse(command: command.text, response: responses))
}
var validResponses = [Response]()
for res in resArr {
if res == "" { break }
validResponses.append(Response(code: try getResponseCode(res, command: command),
message: getResponseMessage(res),
response: res))
}
return validResponses
}
// Returns a `ResponseCode` extracted from the `response`
// Throws an error if no/invalid response code found
static func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
guard
response.characters.count > 2,
let code = Int(response.substring(to: response.index(response.startIndex,
offsetBy: 3))),
command.expectedResponseCodes.map({ $0.rawValue }).contains(code) else {
throw SMTPError(.badResponse(command: command.text,
response: response))
}
return ResponseCode(code)
}
// Returns the reponse message from the response
static func getResponseMessage(_ response: String) -> String {
if response.characters.count < 4 { return "" }
return response.substring(from: response.index(response.startIndex,
offsetBy: 4))
}
}
@@ -131,24 +131,24 @@ extension Attachment {
var dictionary = [String: String]()
switch type {
case .data(let data):
dictionary["CONTENT-TYPE"] = data.mime
var attachmentDisposition = data.inline ? "inline" : "attachment"
if let mime = data.name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mime)\"")
case .data(_, let mime, let name, let inline):
dictionary["CONTENT-TYPE"] = mime
var attachmentDisposition = inline ? "inline" : "attachment"
if let mimeName = name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mimeName)\"")
}
dictionary["CONTENT-DISPOSITION"] = attachmentDisposition
case .file(let file):
dictionary["CONTENT-TYPE"] = file.mime
var attachmentDisposition = file.inline ? "inline" : "attachment"
if let mime = file.name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mime)\"")
case .file(_, let mime, let name, let inline):
dictionary["CONTENT-TYPE"] = mime
var attachmentDisposition = inline ? "inline" : "attachment"
if let mimeName = name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mimeName)\"")
}
dictionary["CONTENT-DISPOSITION"] = attachmentDisposition
case .html(let html):
dictionary["CONTENT-TYPE"] = "text/html; charset=\(html.characterSet)"
case .html(_, let characterSet, _):
dictionary["CONTENT-TYPE"] = "text/html; charset=\(characterSet)"
dictionary["CONTENT-DISPOSITION"] = "inline"
}
@@ -179,9 +179,45 @@ extension Attachment {
}
var isAlternative: Bool {
if case .html(let html) = type, html.alternative {
return true
if case .html(_, _, let alternative) = type {
return alternative
}
return false
}
}
extension Attachment: Equatable {
/// Returns `true` if the `Attachment`s are equal.
public static func ==(lhs: Attachment, rhs: Attachment) -> Bool {
return lhs.additionalHeaders == rhs.additionalHeaders &&
lhs.hasRelated == rhs.hasRelated &&
lhs.headersDictionary == rhs.headersDictionary &&
lhs.isAlternative == rhs.isAlternative &&
lhs.relatedAttachments == rhs.relatedAttachments &&
lhs.type == rhs.type
}
}
extension Attachment.AttachmentType: Equatable {
static func ==(lhs: Attachment.AttachmentType, rhs: Attachment.AttachmentType) -> Bool {
switch (lhs, rhs) {
case (let .data(data1, mime1, name1, inline1), let .data(data2, mime2, name2, inline2)):
return data1 == data2 &&
mime1 == mime2 &&
name1 == name2 &&
inline1 == inline2
case (let .file(path1, mime1, name1, inline1), let .file(path2, mime2, name2, inline2)):
return path1 == path2 &&
mime1 == mime2 &&
name1 == name2 &&
inline1 == inline2
case (let .html(content1, characterSet1, alternative1),
let .html(content2, characterSet2, alternative2)):
return content1 == content2 &&
characterSet1 == characterSet2 &&
alternative1 == alternative2
default:
return false
}
}
}
@@ -19,11 +19,10 @@ import Cryptor
struct AuthEncoder {
static func cramMD5(challenge: String, user: String, password: String) throws -> String {
guard
let hmac = HMAC(using: HMAC.Algorithm.md5,
key: password).update(string: try challenge.base64Decoded())?.final()
else {
throw SMTPError(.md5HashChallengeFail)
guard let hmac = HMAC(
using: HMAC.Algorithm.md5,
key: password).update(string: try challenge.base64Decoded())?.final() else {
throw SMTPError.md5HashChallengeFail
}
let digest = CryptoUtils.hexString(from: hmac)
return ("\(user) \(digest)").base64Encoded
@@ -46,11 +45,9 @@ struct AuthEncoder {
extension String {
func base64Decoded() throws -> String {
guard
let data = Data(base64Encoded: self),
let base64Decoded = String(data: data, encoding: .utf8)
else {
throw SMTPError(.base64DecodeFail(string: self))
guard let data = Data(base64Encoded: self, options: .ignoreUnknownCharacters),
let base64Decoded = String(data: data, encoding: .utf8) else {
throw SMTPError.base64DecodeFail(string: self)
}
return base64Decoded
}
+29
View File
@@ -0,0 +1,29 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Supported authentication methods for logging into the SMTP server.
public enum AuthMethod: String {
/// CRAM-MD5 authentication.
case cramMD5 = "CRAM-MD5"
/// LOGIN authentication.
case login = "LOGIN"
/// PLAIN authentication.
case plain = "PLAIN"
/// XOAUTH2 authentication. Requires a valid access token.
case xoauth2 = "XOAUTH2"
}
@@ -36,18 +36,16 @@ enum Command {
case .ehlo(let domain): return "EHLO \(domain)"
case .helo(let domain): return "HELO \(domain)"
case .starttls: return "STARTTLS"
case .auth(let method, let credentials):
if let credentials = credentials {
return "AUTH \(method.rawValue) \(credentials)"
} else {
return "AUTH \(method.rawValue)"
}
case .authUser(let user): return user
case .authPassword(let password): return password
case .mail(let from): return "MAIL FROM: <\(from)>"
case .rcpt(let to): return "RCPT TO: <\(to)>"
case .mail(let from): return "MAIL FROM:<\(from)>"
case .rcpt(let to): return "RCPT TO:<\(to)>"
case .data: return "DATA"
case .dataEnd: return "\(CRLF)."
case .quit: return "QUIT"
@@ -65,9 +63,9 @@ enum Command {
case .plain: return [.authSucceeded]
case .xoauth2: return [.authSucceeded]
}
case .authUser(_): return [.containingChallenge]
case .authUser: return [.containingChallenge]
case .authPassword: return [.authSucceeded]
case .rcpt(_): return [.commandOK, .willForward]
case .rcpt: return [.commandOK, .willForward]
case .data: return [.startMailInput]
case .quit: return [.connectionClosing, .commandOK]
default: return [.commandOK]
@@ -16,14 +16,26 @@
import Foundation
enum Result<T, Error> {
case success(T)
case failure(Error)
}
let cache = NSCache<AnyObject, AnyObject>()
let CRLF = "\r\n"
extension String {
var base64Encoded: String {
return Data(utf8).base64EncodedString()
}
var base64EncodedWithLineLimit: String {
return Data(utf8).base64EncodedString(options: .lineLength76Characters)
}
var mimeEncoded: String? {
guard let encoded = addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
return nil
}
let quoted = encoded
.replacingOccurrences(of: "%20", with: "_")
.replacingOccurrences(of: ",", with: "%2C")
@@ -31,9 +43,3 @@ extension String {
return "=?UTF-8?Q?\(quoted)?="
}
}
extension String {
var base64Encoded: String {
return Data(utf8).base64EncodedString()
}
}
@@ -15,19 +15,15 @@
**/
import Foundation
import LoggerAPI
// Used to send the content of an email--headers, text, and attachments.
// Should only be invoked after sending the `DATA` command to the server.
// The email is not actually sent until we have indicated that we are done
// sending its contents with a `CRLF CRLF`.
// The email is not actually sent until we have indicated that we are done sending its contents with a `CRLF CRLF`.
// This is handled by `Sender`.
struct DataSender {
// Socket we use to read and write data to
let socket: SMTPSocket
// Cache for attachments. This saves us from encoding data or creating
// files from local files more than we need to.
lazy var cache = NSCache<AnyObject, AnyObject>()
private let socket: SMTPSocket
// Init a new instance of `DataSender`
init(socket: SMTPSocket) {
@@ -35,7 +31,7 @@ struct DataSender {
}
// Send the text and attachments of the `mail`
mutating func send(_ mail: Mail) throws {
func send(_ mail: Mail) throws {
try sendHeaders(mail.headersString)
if mail.hasAttachment {
@@ -58,7 +54,7 @@ extension DataSender {
}
// Send `mail`'s content that is more than just plain text
mutating func sendMixed(_ mail: Mail) throws {
func sendMixed(_ mail: Mail) throws {
let boundary = String.makeBoundary()
let mixedHeader = String.makeMixedHeader(boundary: boundary)
@@ -70,10 +66,9 @@ extension DataSender {
try sendAttachments(mail.attachments, boundary: boundary)
}
// If `mail` has an attachment that is an alternative to plain text, sends
// that attachment and the plain text.
// If `mail` has an attachment that is an alternative to plain text, sends that attachment and the plain text.
// Else just sends the plain text.
mutating func sendAlternative(for mail: Mail) throws {
func sendAlternative(for mail: Mail) throws {
if let alternative = mail.alternative {
let boundary = String.makeBoundary()
let alternativeHeader = String.makeAlternativeHeader(boundary: boundary)
@@ -93,7 +88,7 @@ extension DataSender {
}
// Sends the attachments of a `Mail`.
mutating func sendAttachments(_ attachments: [Attachment], boundary: String) throws {
func sendAttachments(_ attachments: [Attachment], boundary: String) throws {
for attachment in attachments {
try send(boundary.startLine)
try sendAttachment(attachment)
@@ -102,7 +97,7 @@ extension DataSender {
}
// Send the `attachment`.
mutating func sendAttachment(_ attachment: Attachment) throws {
func sendAttachment(_ attachment: Attachment) throws {
var relatedBoundary = ""
if attachment.hasRelated {
@@ -116,22 +111,21 @@ extension DataSender {
try send(attachmentHeader)
switch attachment.type {
case .data(let data): try sendData(data.data)
case .file(let file): try sendFile(at: file.path)
case .html(let html): try sendHTML(html.content)
case .data(let data, _, _, _): try sendData(data)
case .file(let path, _, _, _): try sendFile(at: path)
case .html(let content, _, _): try sendHTML(content)
}
try send("")
if attachment.hasRelated {
try sendAttachments(attachment.relatedAttachments,
boundary: relatedBoundary)
try sendAttachments(attachment.relatedAttachments, boundary: relatedBoundary)
}
}
// Send a data attachment. Data must be base 64 encoded before sending.
// Checks if the base 64 encoded version has been cached first.
mutating func sendData(_ data: Data) throws {
func sendData(_ data: Data) throws {
#if os(macOS)
if let encodedData = cache.object(forKey: data as AnyObject) as? Data {
return try send(encodedData)
@@ -142,7 +136,7 @@ extension DataSender {
}
#endif
let encodedData = data.base64EncodedData()
let encodedData = data.base64EncodedData(options: .lineLength76Characters)
try send(encodedData)
#if os(macOS)
@@ -152,10 +146,9 @@ extension DataSender {
#endif
}
// Sends a local file at the given path. File must be base 64 encoded
// before sending. Checks the cache first.
// Sends a local file at the given path. File must be base 64 encoded before sending. Checks the cache first.
// Throws an error if file could not be found.
mutating func sendFile(at path: String) throws {
func sendFile(at path: String) throws {
#if os(macOS)
if let data = cache.object(forKey: path as AnyObject) as? Data {
return try send(data)
@@ -167,10 +160,10 @@ extension DataSender {
#endif
guard let file = FileHandle(forReadingAtPath: path) else {
throw SMTPError(.fileNotFound(path: path))
throw SMTPError.fileNotFound(path: path)
}
let data = file.readDataToEndOfFile().base64EncodedData()
let data = file.readDataToEndOfFile().base64EncodedData(options: .lineLength76Characters)
try send(data)
file.closeFile()
@@ -183,7 +176,7 @@ extension DataSender {
// Send an HTML attachment. HTML must be base 64 encoded before sending.
// Checks if the base 64 encoded version is in cache first.
mutating func sendHTML(_ html: String) throws {
func sendHTML(_ html: String) throws {
#if os(macOS)
if let encodedHTML = cache.object(forKey: html as AnyObject) as? String {
return try send(encodedHTML)
@@ -194,13 +187,13 @@ extension DataSender {
}
#endif
let encodedHTML = html.base64Encoded
let encodedHTML = html.data(using: .utf8)?.base64EncodedData(options: .lineLength76Characters) ?? Data()
try send(encodedHTML)
#if os(macOS)
cache.setObject(encodedHTML as AnyObject, forKey: html as AnyObject)
#else
cache.setObject(NSString(string: encodedHTML) as AnyObject, forKey: NSString(string: html) as AnyObject)
cache.setObject(NSData(data: encodedHTML) as AnyObject, forKey: NSString(string: html) as AnyObject)
#endif
}
}
@@ -208,29 +201,29 @@ extension DataSender {
private extension DataSender {
// Write `text` to the socket.
func send(_ text: String) throws {
Log.debug("SEND: \(text)")
try socket.write(text)
}
// Write `data` to the socket.
func send(_ data: Data) throws {
Log.debug("SEND: data \(data.count) bytes")
try socket.write(data)
}
}
private extension String {
// Embed plain text content of emails with the proper headers so that it is
// rendered correctly.
// Embed plain text content of emails with the proper headers so that it is entered correctly.
var embedded: String {
var embeddedText = ""
embeddedText += "CONTENT-TYPE: text/html; charset=utf-8\(CRLF)"
embeddedText += "CONTENT-TYPE: text/plain; charset=utf-8\(CRLF)"
embeddedText += "CONTENT-TRANSFER-ENCODING: 7bit\(CRLF)"
embeddedText += "CONTENT-DISPOSITION: inline\(CRLF)"
embeddedText += "\(CRLF)\(self)\(CRLF)"
return embeddedText
}
// The SMTP protocol requires unique boundaries between sections of an
// email.
// The SMTP protocol requires unique boundaries between sections of an email.
static func makeBoundary() -> String {
return UUID().uuidString.replacingOccurrences(of: "-", with: "")
}
@@ -245,15 +238,13 @@ private extension String {
return "CONTENT-TYPE: multipart/alternative; boundary=\"\(boundary)\"\(CRLF)"
}
// Header for an attachment that is related to another attachment.
// (Such as an image attachment that can be referenced by a related HTML
// attachment)
// Header for an attachment that is related to another attachment. (Such as an image attachment that can be
// referenced by a related HTML attachment)
static func makeRelatedHeader(boundary: String) -> String {
return "CONTENT-TYPE: multipart/related; boundary=\"\(boundary)\"\(CRLF)"
}
// Added to a boundary to indicate the beginning of the corresponding
// section.
// Added to a boundary to indicate the beginning of the corresponding section.
var startLine: String {
return "--\(self)"
}
@@ -18,53 +18,70 @@ import Foundation
/// Represents an email that can be sent through an `SMTP` instance.
public struct Mail {
private let uuid = UUID().uuidString
/// A UUID for the mail.
public let uuid = UUID().uuidString
/// The `User` that the `Mail` will be sent from.
public let from: User
/// Array of `User`s to send the `Mail` to.
public let to: [User]
/// Array of `User`s to cc. Defaults to none.
public let cc: [User]
/// Array of `User`s to bcc. Defaults to none.
public let bcc: [User]
/// Subject of the `Mail`. Defaults to none.
public let subject: String
/// Text of the `Mail`. Defaults to none.
public let text: String
/// Array of `Attachment`s for the `Mail`. If the `Mail` has multiple `Attachment`s 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.
public let attachments: [Attachment]
/// Attachment that is an alternative to plain text.
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.
public let additionalHeaders: [String: String]
/// message-id https://tools.ietf.org/html/rfc5322#section-3.6.4
public var id: String {
return "<\(uuid).Swift-SMTP@\(hostname)>"
}
private var hostname: String {
/// Hostname from the email address.
public var hostname: String {
let fullEmail = from.email
let atIndex = fullEmail.characters.index(of: "@")
#if swift(>=4.2)
let atIndex = fullEmail.firstIndex(of: "@")
#else
let atIndex = fullEmail.index(of: "@")
#endif
let hostStart = fullEmail.index(after: atIndex!)
let hostnameVal = fullEmail.substring(from: hostStart)
return hostnameVal
return String(fullEmail[hostStart...])
}
let from: User
let to: [User]
let cc: [User]
let bcc: [User]
let subject: String
let text: String
let attachments: [Attachment]
let alternative: Attachment?
let additionalHeaders: [String: String]
/// Initializes a `Mail` object.
///
/// - Parameters:
/// - hostname: Hostname of the SMTP server to connect to. Should not
/// include any scheme--ie `smtp.example.com` is valid.
/// - from: The `User` that the `Mail` will be sent from.
/// - to: Array of `User`s to send the `Mail` to.
/// - cc: Array of `User`s to cc. Defaults to none.
/// - bcc: Array of `User`s to bcc. Defaults to none.
/// - subject: Subject of the `Mail`. Defaults to none.
/// - text: Text of the `Mail`. Defaults to none.
/// - attachments: Array of `Attachment`s for the `Mail`. If the `Mail`
/// has multiple `Attachment`s that are alternatives to
/// 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.
/// - attachments: Array of `Attachment`s for the `Mail`. If the `Mail` has multiple `Attachment`s 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.
public init(from: User,
to: [User],
cc: [User] = [],
@@ -88,17 +105,19 @@ public struct Mail {
}
private static func getAlternative(_ attachments: [Attachment]) -> (Attachment?, [Attachment]) {
let reversed: [Attachment] = attachments.reversed()
if let index = reversed.index(where: {( $0.isAlternative )}) {
var newAttachments = attachments
return (newAttachments.remove(at: index), newAttachments)
var reversed: [Attachment] = attachments.reversed()
#if swift(>=4.2)
let index = reversed.firstIndex(where: { $0.isAlternative })
#else
let index = reversed.index(where: { $0.isAlternative })
#endif
if let index = index {
return (reversed.remove(at: index), reversed.reversed())
}
return (nil, attachments)
}
}
extension Mail {
var headersDictionary: [String: String] {
private var headersDictionary: [String: String] {
var dictionary = [String: String]()
dictionary["MESSAGE-ID"] = id
dictionary["DATE"] = Date().smtpFormatted
@@ -129,11 +148,38 @@ extension Mail {
return "\(key): \(value)"
}.joined(separator: CRLF)
}
var hasAttachment: Bool {
return !attachments.isEmpty || alternative != nil
}
}
extension Mail {
var hasAttachment: Bool {
return !attachments.isEmpty || alternative != nil
/// Represents a sender or receiver of an email.
public struct User {
/// The user's name that is displayed in an email. Optional.
public let name: String?
/// The user's email address.
public let email: String
/// Initializes a `User`.
///
/// - Parameters:
/// - name: The user's name that is displayed in an email. Optional.
/// - email: The user's email address.
public init(name: String? = nil, email: String) {
self.name = name
self.email = email
}
var mime: String {
if let name = name, let nameEncoded = name.mimeEncoded {
return "\(nameEncoded) <\(email)>"
} else {
return email
}
}
}
}
@@ -20,24 +20,28 @@ import Foundation
import Dispatch
#endif
/// (`Mail`, `Error`) callback after each `Mail` is sent. `Mail` is the mail sent and `Error` is the error if it failed.
public typealias Progress = ((Mail, Error?) -> Void)?
/// ([`Mail`], [(`Mail`, `Error`)]) callback after all `Mail`s have been attempted. [`Mail`] is an array of successfully
/// sent `Mail`s. [(`Mail`, `Error`)] is an array of failed `Mail`s and their corresponding `Error`s.
public typealias Completion = (([Mail], [(Mail, Error)]) -> Void)?
class Sender {
fileprivate var socket: SMTPSocket
fileprivate var pending: [Mail]
fileprivate var progress: Progress
fileprivate var completion: Completion
fileprivate var sent = [Mail]()
fileprivate var failed = [(Mail, Error)]()
var dataSender: DataSender
class MailSender {
private var socket: SMTPSocket
private var mailsToSend: [Mail]
private var progress: Progress
private var completion: Completion
private var sent = [Mail]()
private var failed = [(Mail, Error)]()
private var dataSender: DataSender
init(socket: SMTPSocket,
pending: [Mail],
mailsToSend: [Mail],
progress: Progress,
completion: Completion) {
self.socket = socket
self.pending = pending
self.mailsToSend = mailsToSend
self.progress = progress
self.completion = completion
dataSender = DataSender(socket: socket)
@@ -50,32 +54,28 @@ class Sender {
}
}
private extension Sender {
private extension MailSender {
func sendNext() {
if pending.isEmpty {
if mailsToSend.isEmpty {
completion?(sent, failed)
progress = nil
completion = nil
try? quit()
return
}
let mail = pending.removeFirst()
let mail = mailsToSend.removeFirst()
do {
try send(mail)
if completion != nil {
sent.append(mail)
}
progress?(mail, nil)
} catch {
if completion != nil {
failed.append((mail, error))
}
progress?(mail, error)
}
DispatchQueue.global().async {
self.sendNext()
}
@@ -85,9 +85,7 @@ private extension Sender {
try socket.send(.quit)
socket.close()
}
}
private extension Sender {
func send(_ mail: Mail) throws {
let recipientEmails = try getRecipientEmails(from: mail)
try validateEmails(recipientEmails)
@@ -98,58 +96,53 @@ private extension Sender {
try dataEnd()
}
private func getRecipientEmails(from mail: Mail) throws -> [String] {
func getRecipientEmails(from mail: Mail) throws -> [String] {
var recipientEmails = mail.to.map { $0.email }
recipientEmails += mail.cc.map { $0.email }
recipientEmails += mail.bcc.map { $0.email }
guard !recipientEmails.isEmpty else {
throw SMTPError(.noRecipients)
throw SMTPError.noRecipients
}
return recipientEmails
}
private func validateEmails(_ emails: [String]) throws {
func validateEmails(_ emails: [String]) throws {
for email in emails where try !email.isValidEmail() {
throw SMTPError(.invalidEmail(email: email))
throw SMTPError.invalidEmail(email: email)
}
}
private func sendMail(_ from: String) throws {
func sendMail(_ from: String) throws {
try socket.send(.mail(from))
}
private func sendTo(_ emails: [String]) throws {
func sendTo(_ emails: [String]) throws {
for email in emails {
try socket.send(.rcpt(email))
}
}
private func data() throws {
func data() throws {
try socket.send(.data)
}
private func dataEnd() throws {
func dataEnd() throws {
try socket.send(.dataEnd)
}
}
#if os(Linux) && !swift(>=3.1)
private typealias NSRegularExpression = RegularExpression
#endif
private extension NSRegularExpression {
static let emailRegex = try? NSRegularExpression(pattern: "^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}", options: [])
static let emailRegex = try? NSRegularExpression(pattern: "^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}")
}
extension String {
private extension String {
func isValidEmail() throws -> Bool {
guard let emailRegex = NSRegularExpression.emailRegex else {
throw SMTPError(.createEmailRegexFailed)
throw SMTPError.createEmailRegexFailed
}
let range = NSRange(location: 0, length: self.characters.count)
let range = NSRange(location: 0, length: count)
return !emailRegex.matches(in: self, options: [], range: range).isEmpty
}
}
+158
View File
@@ -0,0 +1,158 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Used to connect to an SMTP server and send emails.
public struct SMTP {
private let hostname: String
private let email: String
private let password: String
private let port: Int32
private let tlsMode: TLSMode
private let tlsConfiguration: TLSConfiguration?
private let authMethods: [String: AuthMethod]
private let domainName: String
private let timeout: UInt
/// 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
}
/// Initializes an `SMTP` instance.
///
/// - Parameters:
/// - hostname: Hostname of the SMTP server to connect to, i.e. `smtp.example.com`.
/// - email: Username to log in to server.
/// - password: Password to log in to server, or access token if using XOAUTH2 authorization method.
/// - port: Port to connect to the server on. Defaults to `465`.
/// - tlsMode: TLSMode `enum` indicating what form of connection security to use.
/// - tlsConfiguration: `TLSConfiguration` used to connect with TLS. If nil, a configuration with no backing
/// certificates is used. See `TLSConfiguration` for other configuration options.
/// - authMethods: `AuthMethod`s to use to log in to the server. If blank, tries all supported methods.
/// - domainName: Client domain name used when communicating with the server. Defaults to `localhost`.
/// - timeout: How long to try connecting to the server to before returning an error. Defaults to `10` seconds.
///
/// - Note:
/// - You may need to enable access for less secure apps for your account on the SMTP server.
/// - Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
/// IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.
public init(hostname: String,
email: String,
password: String,
port: Int32 = 587,
tlsMode: TLSMode = .requireSTARTTLS,
tlsConfiguration: TLSConfiguration? = nil,
authMethods: [AuthMethod] = [],
domainName: String = "localhost",
timeout: UInt = 10) {
self.hostname = hostname
self.email = email
self.password = password
self.port = port
self.tlsMode = tlsMode
self.tlsConfiguration = tlsConfiguration
let _authMethods = !authMethods.isEmpty ? authMethods : [
AuthMethod.cramMD5,
AuthMethod.login,
AuthMethod.plain,
AuthMethod.xoauth2
]
var authMethodsDictionary = [String: AuthMethod]()
_authMethods.forEach { authMethod in
authMethodsDictionary[authMethod.rawValue] = authMethod
}
self.authMethods = authMethodsDictionary
self.domainName = domainName
self.timeout = timeout
}
/// Send an email.
///
/// - Parameters:
/// - mail: `Mail` object to send.
/// - completion: Callback when sending finishes. `Error` is nil on success. (optional)
public func send(_ mail: Mail, completion: ((Error?) -> Void)? = nil) {
send([mail], completion: { (_, failed) in
if let error = failed.first?.1 {
completion?(error)
} else {
completion?(nil)
}
})
}
/// Send multiple emails.
///
/// - Parameters:
/// - mails: Array of `Mail`s to send.
/// - progress: (`Mail`, `Error`) callback after each `Mail` is sent. `Mail` is the mail sent and `Error` is
/// the error if it failed. (optional)
/// - completion: ([`Mail`], [(`Mail`, `Error`)]) callback after all `Mail`s have been attempted. [`Mail`] is an
/// array of successfully sent `Mail`s. [(`Mail`, `Error`)] is an array of failed `Mail`s and their
/// corresponding `Error`s. (optional)
///
/// - Note:
/// - Each call to `send` will first log in to your server, attempt to send the mails, then closes the
/// connection. Pass in an array of `Mail`s to send them all in one session.
/// - If any of the email addresses in a `Mail`'s `to`, `cc`, or `bcc` are invalid, the entire mail will not
/// send and return an `SMTPError`.
/// - If an individual `Mail` fails while sending an array of `Mail`s, the whole sending process will continue
/// until all pending `Mail`s are attempted.
/// - Each call to `send` queues it's `Mail`s and sends them one by one. To send `Mail`s concurrently, send them
/// in separate calls to `send`.
public func send(_ mails: [Mail],
progress: Progress = nil,
completion: Completion = nil) {
if mails.isEmpty {
completion?([], [])
return
}
do {
let socket = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: port,
tlsMode: tlsMode,
tlsConfiguration: tlsConfiguration,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
MailSender(
socket: socket,
mailsToSend: mails,
progress: progress,
completion: completion).send()
} catch {
completion?([], mails.map { ($0, error) })
}
}
}
@@ -30,13 +30,8 @@ public enum SMTPError: Error, CustomStringConvertible {
/// File not found at path while trying to send file `Attachment`.
case fileNotFound(path: String)
/// The preferred `AuthMethod`s could not be found. Connecting with `SSL`
/// may be required.
case noSupportedAuthMethods(hostname: String)
/// Attempted to login using `XOAUTH2` but `SMTP` instance was initialized
/// without an access token.
case noAccessToken
/// The preferred `AuthMethod`s could not be found, or your server is sending back a STARTTLS command and requires a connection upgrade.
case noAuthMethodsOrRequiresTLS(hostname: String)
// Sender
/// Mail has no recipients.
@@ -55,6 +50,9 @@ public enum SMTPError: Error, CustomStringConvertible {
// User
/// Invalid email provided for `User`.
case invalidEmail(email: String)
/// STARTTLS was required but the server did not request it.
case requiredSTARTTLS
/// Description of the `SMTPError`.
public var description: String {
@@ -62,18 +60,18 @@ public enum SMTPError: Error, CustomStringConvertible {
case .base64DecodeFail(let s): return "Error decoding string: \(s)."
case .md5HashChallengeFail: return "Hashing server challenge with MD5 algorithm failed."
case .fileNotFound(let p): return "File not found at path while trying to send file `Attachment`: \(p)."
case .noSupportedAuthMethods(let hostname): return "The preferred authorization methods could not be found on \(hostname). Connecting with SSL may be required."
case .noAccessToken: return "Attempted to login using XOAUTH2 but SMTP instance was initialized without an access token."
case .noAuthMethodsOrRequiresTLS(let hostname): return "The preferred authorization methods could not be found on \(hostname), or your server is sending back a STARTTLS command and requires a connection upgrade."
case .noRecipients: return "An email requires at least one recipient."
case .createEmailRegexFailed: return "Failed to create RegularExpression that can check if an email is valid."
case .badResponse(let command, let response): return "Bad response received for command. command: (\(command)), response: \(response)"
case .convertDataUTF8Fail(let buf): return "Error converting Data read from socket to a String: \(buf)."
case .invalidEmail(let email): return "Invalid email provided for User: \(email)."
case .requiredSTARTTLS: return "STARTTLS was required but the server did not issue a STARTTLS command."
}
}
init(_ error: SMTPError) {
self = error
Log.error(self.description)
Log.error(description)
}
}
+239
View File
@@ -0,0 +1,239 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
import Socket
import LoggerAPI
struct SMTPSocket {
private let socket: Socket
init(hostname: String,
email: String,
password: String,
port: Int32,
tlsMode: SMTP.TLSMode,
tlsConfiguration: TLSConfiguration?,
authMethods: [String: AuthMethod],
domainName: String,
timeout: UInt) throws {
socket = try Socket.create()
if tlsMode == .requireTLS {
if let tlsConfiguration = tlsConfiguration {
socket.delegate = try tlsConfiguration.makeSSLService()
} else {
socket.delegate = try TLSConfiguration().makeSSLService()
}
}
try socket.connect(to: hostname, port: port, timeout: timeout * 1000)
try parseResponses(readFromSocket(), command: .connect)
var serverOptions = try getServerOptions(domainName: domainName)
if tlsMode == .requireSTARTTLS || tlsMode == .normal {
if try doStarttls(serverOptions: serverOptions, tlsConfiguration: tlsConfiguration) {
serverOptions = try getServerOptions(domainName: domainName)
} else if tlsMode == .requireSTARTTLS {
throw SMTPError.requiredSTARTTLS
}
}
let authMethod = try getAuthMethod(authMethods: authMethods, serverOptions: serverOptions, hostname: hostname)
try login(authMethod: authMethod, email: email, password: password)
}
func write(_ text: String) throws {
_ = try socket.write(from: text + CRLF)
Log.debug(text)
}
func write(_ data: Data) throws {
_ = try socket.write(from: data)
Log.debug("(sending data)")
}
@discardableResult
func send(_ command: Command) throws -> [Response] {
try write(command.text)
return try parseResponses(readFromSocket(), command: command)
}
func close() {
socket.close()
}
}
private extension SMTPSocket {
func readFromSocket() throws -> String {
var buf = Data()
_ = try socket.read(into: &buf)
guard let responses = String(data: buf, encoding: .utf8) else {
throw SMTPError.convertDataUTF8Fail(data: buf)
}
Log.debug(responses)
return responses
}
@discardableResult
func parseResponses(_ responses: String, command: Command) throws -> [Response] {
let responsesArray = responses.components(separatedBy: CRLF)
guard !responsesArray.isEmpty else {
throw SMTPError.badResponse(command: command.text, response: responses)
}
#if swift(>=4.1)
return try responsesArray.compactMap { response in
guard response != "" else {
return nil
}
return Response(
code: try getResponseCode(response, command: command),
message: getResponseMessage(response),
response: response
)
}
#else
return try responsesArray.flatMap { response in
guard response != "" else {
return nil
}
return Response(
code: try getResponseCode(response, command: command),
message: getResponseMessage(response),
response: response
)
}
#endif
}
func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
guard response.count > 3 else {
throw SMTPError.badResponse(command: command.text, response: response)
}
guard let code = Int(response[..<response.index(response.startIndex, offsetBy: 3)]) else {
throw SMTPError.badResponse(command: command.text, response: response)
}
guard
response.count > 2,
command.expectedResponseCodes.map({ $0.rawValue }).contains(code) else {
throw SMTPError.badResponse(command: command.text, response: response)
}
return ResponseCode(code)
}
func getResponseMessage(_ response: String) -> String {
guard response.count > 3 else {
return ""
}
return String(response[response.index(response.startIndex, offsetBy: 4)...])
}
}
private extension SMTPSocket {
func getServerOptions(domainName: String) throws -> [Response] {
do {
return try send(.ehlo(domainName))
} catch {
return try send(.helo(domainName))
}
}
func getAuthMethod(authMethods: [String: AuthMethod], serverOptions: [Response], hostname: String) throws -> AuthMethod {
for option in serverOptions {
let components = option.message.components(separatedBy: " ")
if components.first == "AUTH" {
let _authMethods = components.dropFirst()
for authMethod in _authMethods {
if let matchingAuthMethod = authMethods[authMethod] {
return matchingAuthMethod
}
}
}
}
throw SMTPError.noAuthMethodsOrRequiresTLS(hostname: hostname)
}
func doStarttls(serverOptions: [Response], tlsConfiguration: TLSConfiguration?) throws -> Bool {
for option in serverOptions {
if option.message == "STARTTLS" {
try starttls(tlsConfiguration: tlsConfiguration)
return true
}
}
return false
}
func starttls(tlsConfiguration: TLSConfiguration?) throws {
try send(.starttls)
// Upgrade the socket to SSL/TLS
if let tlsConfiguration = tlsConfiguration {
socket.delegate = try tlsConfiguration.makeSSLService()
} else {
socket.delegate = try TLSConfiguration().makeSSLService()
}
try socket.delegate?.initialize(asServer: false)
try socket.delegate?.onConnect(socket: socket)
}
func login(authMethod: AuthMethod, email: String, password: String) throws {
switch authMethod {
case .cramMD5:
try loginCramMD5(email: email, password: password)
case .login:
try loginLogin(email: email, password: password)
case .plain:
try loginPlain(email: email, password: password)
case .xoauth2:
try loginXOAuth2(email: email, accessToken: password)
}
}
func loginCramMD5(email: String, password: String) throws {
let challenge = try auth(authMethod: .cramMD5, credentials: nil).message
try authPassword(try AuthEncoder.cramMD5(challenge: challenge, user: email, password: password))
}
func loginLogin(email: String, password: String) throws {
try auth(authMethod: .login, credentials: nil)
let credentials = AuthEncoder.login(user: email, password: password)
try authUser(credentials.encodedUser)
try authPassword(credentials.encodedPassword)
}
func loginPlain(email: String, password: String) throws {
try auth(
authMethod: .plain,
credentials: AuthEncoder.plain(user: email, password: password)
)
}
func loginXOAuth2(email: String, accessToken: String) throws {
try auth(authMethod: .xoauth2, credentials: AuthEncoder.xoauth2(user: email, accessToken: accessToken))
}
@discardableResult
func auth(authMethod: AuthMethod, credentials: String?) throws -> Response {
let responses = try send(.auth(authMethod, credentials))
guard let response = responses.first else {
throw SMTPError.badResponse(command: "AUTH", response: responses.description)
}
return response
}
func authUser(_ user: String) throws {
try send(.authUser(user))
}
func authPassword(_ password: String) throws {
try send(.authPassword(password))
}
}
@@ -17,12 +17,9 @@
import Foundation
import SSLService
/// Configuration to connect securely through SSL/TLS.
/// Create an `SSL` based on your requirements and pass it along to your `SMTP`
/// struct as an initialization parameter.
/// https://github.com/IBM-Swift/BlueSSLService
public struct SSL {
let config: SSLService.Configuration
/// Configuration for connecting with TLS. For more info, see https://github.com/Kitura/BlueSSLService.
public struct TLSConfiguration {
private let configuration: SSLService.Configuration
///
/// Initialize a configuration with no backing certificates.
@@ -31,8 +28,12 @@ public struct SSL {
/// - cipherSuite: Optional String containing the cipher suite to use.
/// - clientAllowsSelfSignedCertificates:
/// `true` to accept self-signed certificates from a server. `false` otherwise.
public init(withCipherSuite cipherSuite: String? = nil, clientAllowsSelfSignedCertificates: Bool = false) {
config = SSLService.Configuration(withCipherSuite: cipherSuite, clientAllowsSelfSignedCertificates: clientAllowsSelfSignedCertificates)
public init(withCipherSuite cipherSuite: String? = nil,
clientAllowsSelfSignedCertificates: Bool = false) {
configuration = SSLService.Configuration(
withCipherSuite: cipherSuite,
clientAllowsSelfSignedCertificates: clientAllowsSelfSignedCertificates
)
}
///
@@ -44,8 +45,18 @@ public struct SSL {
/// - keyFilePath: Path to the PEM formatted key file. If nil, `certificateFilePath` will be used.
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
/// - cipherSuite: Optional String containing the cipher suite to use.
public init(withCACertificateFilePath caCertificateFilePath: String?, usingCertificateFile certificateFilePath: String?, withKeyFile keyFilePath: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
config = SSLService.Configuration(withCACertificateFilePath: caCertificateFilePath, usingCertificateFile: certificateFilePath, withKeyFile: keyFilePath, usingSelfSignedCerts: selfSigned, cipherSuite: cipherSuite)
public init(withCACertificateFilePath caCertificateFilePath: String?,
usingCertificateFile certificateFilePath: String?,
withKeyFile keyFilePath: String? = nil,
usingSelfSignedCerts selfSigned: Bool = true,
cipherSuite: String? = nil) {
configuration = SSLService.Configuration(
withCACertificateFilePath: caCertificateFilePath,
usingCertificateFile: certificateFilePath,
withKeyFile: keyFilePath,
usingSelfSignedCerts: selfSigned,
cipherSuite: cipherSuite
)
}
///
@@ -59,8 +70,18 @@ public struct SSL {
/// - keyFilePath: Path to the PEM formatted key file (optional). If nil, `certificateFilePath` is used.
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
/// - cipherSuite: Optional String containing the cipher suite to use.
public init(withCACertificateDirectory caCertificateDirPath: String?, usingCertificateFile certificateFilePath: String?, withKeyFile keyFilePath: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
config = SSLService.Configuration(withCACertificateDirectory: caCertificateDirPath, usingCertificateFile: certificateFilePath, withKeyFile: keyFilePath, usingSelfSignedCerts: selfSigned, cipherSuite: cipherSuite)
public init(withCACertificateDirectory caCertificateDirPath: String?,
usingCertificateFile certificateFilePath: String?,
withKeyFile keyFilePath: String? = nil,
usingSelfSignedCerts selfSigned: Bool = true,
cipherSuite: String? = nil) {
configuration = SSLService.Configuration(
withCACertificateDirectory: caCertificateDirPath,
usingCertificateFile: certificateFilePath,
withKeyFile: keyFilePath,
usingSelfSignedCerts: selfSigned,
cipherSuite: cipherSuite
)
}
///
@@ -74,8 +95,19 @@ public struct SSL {
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
/// - clientAllowsSelfSignedCertificates: True if, as a client, connections to self-signed servers are allowed
/// - cipherSuite: Optional String containing the cipher suite to use.
public init(withChainFilePath chainFilePath: String?, withPassword password: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, clientAllowsSelfSignedCertificates: Bool = false, cipherSuite: String? = nil) {
config = SSLService.Configuration(withChainFilePath: chainFilePath, withPassword: password, usingSelfSignedCerts: selfSigned, clientAllowsSelfSignedCertificates: clientAllowsSelfSignedCertificates, cipherSuite: cipherSuite)
public init(withChainFilePath chainFilePath: String?,
withPassword password: String? = nil,
usingSelfSignedCerts selfSigned: Bool = true,
clientAllowsSelfSignedCertificates: Bool = false,
cipherSuite: String? = nil) {
configuration = SSLService.Configuration(
withChainFilePath: chainFilePath,
withPassword: password,
usingSelfSignedCerts: selfSigned,
clientAllowsSelfSignedCertificates:
clientAllowsSelfSignedCertificates,
cipherSuite: cipherSuite
)
}
#if os(Linux)
@@ -86,12 +118,18 @@ public struct SSL {
/// - certificateString: PEM formatted certificate in String form.
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
/// - cipherSuite: Optional String containing the cipher suite to use.
public init(withPEMCertificateString certificateString: String, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
config = SSLService.Configuration(withPEMCertificateString: certificateString, usingSelfSignedCerts: selfSigned, cipherSuite: cipherSuite)
public init(withPEMCertificateString certificateString: String,
usingSelfSignedCerts selfSigned: Bool = true,
cipherSuite: String? = nil) {
configuration = SSLService.Configuration(
withPEMCertificateString: certificateString,
usingSelfSignedCerts: selfSigned,
cipherSuite: cipherSuite
)
}
#endif
func makeSSLService() throws -> SSLService? {
return try SSLService(usingConfiguration: config)
return try SSLService(usingConfiguration: configuration)
}
}
-43
View File
@@ -1,43 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Represents a sender or receiver of an email.
public struct User {
fileprivate let name: String?
let email: String
/// Initializes a `User`.
///
/// - Parameters:
/// - name: Display name for the user. (optional)
/// - email: Email address for the user.
public init(name: String? = nil, email: String) {
self.name = name
self.email = email
}
}
extension User {
var mime: String {
if let name = name, let nameEncoded = name.mimeEncoded {
return "\(nameEncoded) <\(email)>"
} else {
return email
}
}
}
+13 -30
View File
@@ -22,35 +22,19 @@ srand(UInt32(time(nil)))
// http://stackoverflow.com/questions/24026510/how-do-i-shuffle-an-array-in-swift
#if !swift(>=3.2)
extension MutableCollection where Indices.Iterator.Element == Index {
mutating func shuffle() {
let c = count
guard c > 1 else { return }
extension MutableCollection {
mutating func shuffle() {
let c = count
guard c > 1 else { return }
for (firstUnshuffled , unshuffledCount) in zip(indices, stride(from: c, to: 1, by: -1)) {
let d: IndexDistance = numericCast(random() % numericCast(unshuffledCount))
guard d != 0 else { continue }
let i = index(firstUnshuffled, offsetBy: d)
swap(&self[firstUnshuffled], &self[i])
}
for (firstUnshuffled, unshuffledCount) in zip(indices, stride(from: c, to: 1, by: -1)) {
let d: Int = numericCast(random() % numericCast(unshuffledCount))
guard d != 0 else { continue }
let i = index(firstUnshuffled, offsetBy: d)
self.swapAt(firstUnshuffled, i)
}
}
#else
extension MutableCollection {
mutating func shuffle() {
let c = count
guard c > 1 else { return }
for (firstUnshuffled , unshuffledCount) in zip(indices, stride(from: c, to: 1, by: -1)) {
let d: IndexDistance = numericCast(random() % numericCast(unshuffledCount))
guard d != 0 else { continue }
let i = index(firstUnshuffled, offsetBy: d)
self.swapAt(firstUnshuffled, i)
}
}
}
#endif
}
extension Sequence {
func shuffled() -> [Iterator.Element] {
@@ -64,8 +48,7 @@ XCTMain([
testCase(TestAttachment.allTests.shuffled()),
testCase(TestAuthEncoder.allTests.shuffled()),
testCase(TestDataSender.allTests.shuffled()),
testCase(TestLogin.allTests.shuffled()),
testCase(TestMailSender.allTests.shuffled()),
testCase(TestMiscellaneous.allTests.shuffled()),
testCase(TestSender.allTests.shuffled()),
testCase(TestSMTPSocket.allTests.shuffled())
].shuffled())
testCase(TestSMTPSocket.allTests.shuffled()),
testCase(TestTLSMode.allTests.shuffled())].shuffled())
+102 -109
View File
@@ -23,130 +23,123 @@ import Foundation
let testDuration: Double = 15
// Fill in your own SMTP login info for local testing
let localHostname: String? = nil
let localEmail: String? = nil
let localPassword: String? = nil
let localPort: SwiftSMTP.Port? = nil
let localSecure: Bool? = nil
let localAuthMethods: [AuthMethod]? = nil
let validMessageIdMsg = "Valid Message-Id header found"
let invalidMessageIdMsg = "Message-Id header missing or invalid"
let multipleMessageIdsMsg = "More than one Message-Id header found"
let hostname: String = {
if let localHostname = localHostname {
return localHostname
}
let url = credentialsDir.appendingPathComponent("/hostname.txt")
guard
let data = try? Data(contentsOf: url),
let hostname = String(data: data, encoding: .utf8)
else {
return "smtp.gmail.com"
}
return hostname.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines)
}()
let email: String = {
if let localEmail = localEmail {
return localEmail
}
let url = credentialsDir.appendingPathComponent("/email.txt")
guard
let data = try? Data(contentsOf: url),
let email = String(data: data, encoding: .utf8)
else {
fatalError("Could not get email to login for tests.")
}
return email.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines)
}()
let password: String = {
if let localPassword = localPassword {
return localPassword
}
let url = credentialsDir.appendingPathComponent("/password.txt")
guard
let data = try? Data(contentsOf: url),
let password = String(data: data, encoding: .utf8)
else {
fatalError("Could not get password to login for tests.")
}
return password.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines)
}()
let port: SwiftSMTP.Port = {
if let localPort = localPort {
return localPort
} else {
return Ports.tls.rawValue
}
}()
let secure: Bool = {
if let localSecure = localSecure {
return localSecure
} else {
return true
}
}()
let authMethods: [AuthMethod] = {
if let localAuthMethods = localAuthMethods {
return localAuthMethods
} else {
return [.cramMD5, .login, .plain]
}
}()
let senderEmailDomain: String = {
let senderEmail = email
if let atIndex = senderEmail.characters.index(of: "@") {
let domainStart = senderEmail.index(after: atIndex)
let domainVal = senderEmail.substring(from: domainStart)
return domainVal
}
return "gmail.com"
}()
// 📧📧📧 Fill in your own SMTP login info for local testing
// DO NOT CHECK IN YOUR EMAIL CREDENTALS!!!
let hostname = "mail.kitura.dev"
let myEmail: String? = nil
let myPassword: String? = nil
let portTLS: Int32 = 465
let portPlain: Int32 = 2525
let authMethods: [String: AuthMethod] = [
AuthMethod.cramMD5.rawValue: .cramMD5,
AuthMethod.login.rawValue: .login,
AuthMethod.plain.rawValue: .plain
]
let domainName = "localhost"
let timeout: UInt = 10
#if os(Linux)
let cert = testsDir + "/cert.pem"
let key = testsDir + "/key.pem"
let ssl = SSL(withCACertificateDirectory: nil, usingCertificateFile: cert, withKeyFile: key)
let email: String = {
if let email = myEmail {
return email
}
guard let email = ProcessInfo.processInfo.environment["EMAIL"] else {
fatalError("Please provide email credentials for local testing.")
}
return email
}()
let password: String = {
if let password = myPassword {
return password
}
guard let password = ProcessInfo.processInfo.environment["PASSWORD"] else {
fatalError("Please provide email credentials for local testing.")
}
return password
}()
let senderEmailDomain: String = {
#if swift(>=5)
if let atIndex = email.firstIndex(of: "@") {
let domainStart = email.index(after: atIndex)
return String(email[domainStart...])
} else {
return "gmail.com"
}
#else
let cert = testsDir + "/cert.pfx"
let certPassword = "kitura"
let ssl = SSL(withChainFilePath: cert, withPassword: certPassword)
if let atIndex = email.index(of: "@") {
let domainStart = email.index(after: atIndex)
return String(email[domainStart...])
} else {
return "gmail.com"
}
#endif
let smtp = SMTP(hostname: hostname, email: email, password: password)
let from = User(name: "Dr. Light", email: email)
let to = User(name: "Megaman", email: email)
let to2 = User(name: "Roll", email: email)
let text = "Humans and robots living together in harmony and equality:<br><br>That was my ultimate wish."
let html = "<html><img src=\"http://vignette2.wikia.nocookie.net/megaman/images/4/40/StH250RobotMasters.jpg/revision/latest?cb=20130711161323\"/></html>"
let imgFilePath = testsDir + "/x.png"
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
let credentialsDir: URL = {
return URL(fileURLWithPath: #file).appendingPathComponent("../../../Kitura-TestingCredentials/Swift-SMTP").standardized
}()
let testsDir: String = {
return URL(fileURLWithPath: #file).appendingPathComponent("..").standardized.path
}()
#if os(Linux)
let cert = testsDir + "/cert.pem"
let key = testsDir + "/key.pem"
let tlsConfiguration = TLSConfiguration(withCACertificateDirectory: nil, usingCertificateFile: cert, withKeyFile: key)
#else
let cert = testsDir + "/cert.pfx"
let certPassword = "kitura"
let tlsConfiguration = TLSConfiguration(withChainFilePath: cert, withPassword: certPassword)
#endif
let smtp = SMTP(hostname: hostname, email: email, password: password)
let from = Mail.User(name: "Dr. Light", email: email)
let to = Mail.User(name: "Megaman", email: email)
let to2 = Mail.User(name: "Roll", email: email)
let text = "Humans and robots living together in harmony and equality: That was my ultimate wish."
let html = "<html><img src=\"http://vignette2.wikia.nocookie.net/megaman/images/4/40/StH250RobotMasters.jpg/revision/latest?cb=20130711161323\"/></html>"
let imgFilePath = testsDir + "/x.png"
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
let validMessageIdMsg = "Valid Message-Id header found"
let invalidMessageIdMsg = "Message-Id header missing or invalid"
let multipleMessageIdsMsg = "More than one Message-Id header found"
// https://www.base64decode.org/
let randomText1 = "Picture removal detract earnest is by. Esteems met joy attempt way clothes yet demesne tedious. Replying an marianne do it an entrance advanced. Two dare say play when hold. Required bringing me material stanhill jointure is as he. Mutual indeed yet her living result matter him bed whence."
let randomText1Encoded = "UGljdHVyZSByZW1vdmFsIGRldHJhY3QgZWFybmVzdCBpcyBieS4gRXN0ZWVtcyBtZXQgam95IGF0dGVtcHQgd2F5IGNsb3RoZXMgeWV0IGRlbWVzbmUgdGVkaW91cy4gUmVwbHlpbmcgYW4gbWFyaWFubmUgZG8gaXQgYW4gZW50cmFuY2UgYWR2YW5jZWQuIFR3byBkYXJlIHNheSBwbGF5IHdoZW4gaG9sZC4gUmVxdWlyZWQgYnJpbmdpbmcgbWUgbWF0ZXJpYWwgc3RhbmhpbGwgam9pbnR1cmUgaXMgYXMgaGUuIE11dHVhbCBpbmRlZWQgeWV0IGhlciBsaXZpbmcgcmVzdWx0IG1hdHRlciBoaW0gYmVkIHdoZW5jZS4="
let randomText1EncodedWithLineLimit = """
UGljdHVyZSByZW1vdmFsIGRldHJhY3QgZWFybmVzdCBpcyBieS4gRXN0ZWVtcyBtZXQgam95IGF0
dGVtcHQgd2F5IGNsb3RoZXMgeWV0IGRlbWVzbmUgdGVkaW91cy4gUmVwbHlpbmcgYW4gbWFyaWFu
bmUgZG8gaXQgYW4gZW50cmFuY2UgYWR2YW5jZWQuIFR3byBkYXJlIHNheSBwbGF5IHdoZW4gaG9s
ZC4gUmVxdWlyZWQgYnJpbmdpbmcgbWUgbWF0ZXJpYWwgc3RhbmhpbGwgam9pbnR1cmUgaXMgYXMg
aGUuIE11dHVhbCBpbmRlZWQgeWV0IGhlciBsaXZpbmcgcmVzdWx0IG1hdHRlciBoaW0gYmVkIHdo
ZW5jZS4=
""".replacingOccurrences(of: "\n", with: "\r\n")
let randomText2 = "Brillo viento gas esa contar hay. Alla no toda lune faro daba en pero. Ir rumiar altura id venian. El robusto hablado ya diarios tu hacerla mermado. Las sus renunciaba llamaradas misteriosa doscientas favorcillo dos pie. Una era fue pedirselos periodicos doscientas actualidad con. Exigian un en oh algunos adivino parezca notario yo. Eres oro dos mal lune vivo sepa les seda. Tio energia una esa abultar por tufillo sirenas persona suspiro. Me pandero tardaba pedirme puertas so senales la."
let randomText2Encoded = "QnJpbGxvIHZpZW50byBnYXMgZXNhIGNvbnRhciBoYXkuIEFsbGEgbm8gdG9kYSBsdW5lIGZhcm8gZGFiYSBlbiBwZXJvLiBJciBydW1pYXIgYWx0dXJhIGlkIHZlbmlhbi4gRWwgcm9idXN0byBoYWJsYWRvIHlhIGRpYXJpb3MgdHUgaGFjZXJsYSBtZXJtYWRvLiBMYXMgc3VzIHJlbnVuY2lhYmEgbGxhbWFyYWRhcyBtaXN0ZXJpb3NhIGRvc2NpZW50YXMgZmF2b3JjaWxsbyBkb3MgcGllLiBVbmEgZXJhIGZ1ZSBwZWRpcnNlbG9zIHBlcmlvZGljb3MgZG9zY2llbnRhcyBhY3R1YWxpZGFkIGNvbi4gRXhpZ2lhbiB1biBlbiBvaCBhbGd1bm9zIGFkaXZpbm8gcGFyZXpjYSBub3RhcmlvIHlvLiBFcmVzIG9ybyBkb3MgbWFsIGx1bmUgdml2byBzZXBhIGxlcyBzZWRhLiBUaW8gZW5lcmdpYSB1bmEgZXNhIGFidWx0YXIgcG9yIHR1ZmlsbG8gc2lyZW5hcyBwZXJzb25hIHN1c3Bpcm8uIE1lIHBhbmRlcm8gdGFyZGFiYSBwZWRpcm1lIHB1ZXJ0YXMgc28gc2VuYWxlcyBsYS4="
let randomText2EncodedWithLineLimit = """
QnJpbGxvIHZpZW50byBnYXMgZXNhIGNvbnRhciBoYXkuIEFsbGEgbm8gdG9kYSBsdW5lIGZhcm8g
ZGFiYSBlbiBwZXJvLiBJciBydW1pYXIgYWx0dXJhIGlkIHZlbmlhbi4gRWwgcm9idXN0byBoYWJs
YWRvIHlhIGRpYXJpb3MgdHUgaGFjZXJsYSBtZXJtYWRvLiBMYXMgc3VzIHJlbnVuY2lhYmEgbGxh
bWFyYWRhcyBtaXN0ZXJpb3NhIGRvc2NpZW50YXMgZmF2b3JjaWxsbyBkb3MgcGllLiBVbmEgZXJh
IGZ1ZSBwZWRpcnNlbG9zIHBlcmlvZGljb3MgZG9zY2llbnRhcyBhY3R1YWxpZGFkIGNvbi4gRXhp
Z2lhbiB1biBlbiBvaCBhbGd1bm9zIGFkaXZpbm8gcGFyZXpjYSBub3RhcmlvIHlvLiBFcmVzIG9y
byBkb3MgbWFsIGx1bmUgdml2byBzZXBhIGxlcyBzZWRhLiBUaW8gZW5lcmdpYSB1bmEgZXNhIGFi
dWx0YXIgcG9yIHR1ZmlsbG8gc2lyZW5hcyBwZXJzb25hIHN1c3Bpcm8uIE1lIHBhbmRlcm8gdGFy
ZGFiYSBwZWRpcm1lIHB1ZXJ0YXMgc28gc2VuYWxlcyBsYS4=
""".replacingOccurrences(of: "\n", with: "\r\n")
let randomText3 = "Intueor veritas suo majoris attinet rem res aggredi similia mei. Disputari abducerem ob ex ha interitum conflatos concipiam. Curam plura aequo rem etc serio fecto caput. Ea posterum lectorem remanere experiar videamus gi cognitum vi. Ad invenit accepit to petitis ea usitata ad. Hoc nam quibus hos oculis cumque videam ita. Res cau infinitum quadratam sanguinem."
let randomText3Encoded = "SW50dWVvciB2ZXJpdGFzIHN1byBtYWpvcmlzIGF0dGluZXQgcmVtIHJlcyBhZ2dyZWRpIHNpbWlsaWEgbWVpLiBEaXNwdXRhcmkgYWJkdWNlcmVtIG9iIGV4IGhhIGludGVyaXR1bSBjb25mbGF0b3MgY29uY2lwaWFtLiBDdXJhbSBwbHVyYSBhZXF1byByZW0gZXRjIHNlcmlvIGZlY3RvIGNhcHV0LiBFYSBwb3N0ZXJ1bSBsZWN0b3JlbSByZW1hbmVyZSBleHBlcmlhciB2aWRlYW11cyBnaSBjb2duaXR1bSB2aS4gQWQgaW52ZW5pdCBhY2NlcGl0IHRvIHBldGl0aXMgZWEgdXNpdGF0YSBhZC4gSG9jIG5hbSBxdWlidXMgaG9zIG9jdWxpcyBjdW1xdWUgdmlkZWFtIGl0YS4gUmVzIGNhdSBpbmZpbml0dW0gcXVhZHJhdGFtIHNhbmd1aW5lbS4="
let randomText3EncodedWithLineLimit = """
SW50dWVvciB2ZXJpdGFzIHN1byBtYWpvcmlzIGF0dGluZXQgcmVtIHJlcyBhZ2dyZWRpIHNpbWls
aWEgbWVpLiBEaXNwdXRhcmkgYWJkdWNlcmVtIG9iIGV4IGhhIGludGVyaXR1bSBjb25mbGF0b3Mg
Y29uY2lwaWFtLiBDdXJhbSBwbHVyYSBhZXF1byByZW0gZXRjIHNlcmlvIGZlY3RvIGNhcHV0LiBF
YSBwb3N0ZXJ1bSBsZWN0b3JlbSByZW1hbmVyZSBleHBlcmlhciB2aWRlYW11cyBnaSBjb2duaXR1
bSB2aS4gQWQgaW52ZW5pdCBhY2NlcGl0IHRvIHBldGl0aXMgZWEgdXNpdGF0YSBhZC4gSG9jIG5h
bSBxdWlidXMgaG9zIG9jdWxpcyBjdW1xdWUgdmlkZWFtIGl0YS4gUmVzIGNhdSBpbmZpbml0dW0g
cXVhZHJhdGFtIHNhbmd1aW5lbS4=
""".replacingOccurrences(of: "\n", with: "\r\n")
+17 -1
View File
@@ -22,7 +22,8 @@ class TestAttachment: XCTestCase {
return [
("testDataAttachmentHeaders", testDataAttachmentHeaders),
("testFileAttachmentHeaders", testFileAttachmentHeaders),
("testHTMLAttachmentHeaders", testHTMLAttachmentHeaders)
("testHTMLAttachmentHeaders", testHTMLAttachmentHeaders),
("testGetAlternativeAttachment", testGetAlternativeAttachment)
]
}
@@ -47,6 +48,21 @@ class TestAttachment: XCTestCase {
XCTAssert(headers.contains("CONTENT-TYPE: text/html; charset=utf-8"))
XCTAssert(headers.contains("CONTENT-DISPOSITION: inline"))
XCTAssert(headers.contains("CONTENT-TRANSFER-ENCODING: BASE64"))
}
func testGetAlternativeAttachment() {
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
let imgAttachment = Attachment(filePath: imgFilePath, additionalHeaders: ["CONTENT-ID": "megaman-pic"])
let htmlAttachment1 = Attachment(htmlContent: "<html><img src=\"cid:megaman-pic\"/>\(text)</html>", relatedAttachments: [imgAttachment])
let jsonAttachment = Attachment(data: data, mime: "application/json", name: "file.json")
let htmlAttachment2 = Attachment(htmlContent: "<html>hello</html>")
let attachments = [htmlAttachment1, imgAttachment, jsonAttachment, htmlAttachment2]
let mail = Mail(from: from, to: [to], subject: "HTML with related attachment, plus additional attachment", text: text, attachments: attachments)
XCTAssert(htmlAttachment1.isAlternative)
XCTAssert(!jsonAttachment.isAlternative)
XCTAssertEqual(mail.attachments, [htmlAttachment1, imgAttachment, jsonAttachment])
XCTAssert(mail.alternative!.isAlternative)
XCTAssertEqual(mail.alternative!, htmlAttachment2)
}
}
-148
View File
@@ -23,9 +23,6 @@ import XCTest
class TestDataSender: XCTestCase {
static var allTests = [
("testDataCache", testDataCache),
("testFileCache", testFileCache),
("testHTMLCache", testHTMLCache),
("testSendData", testSendData),
("testSendFile", testSendFile),
("testSendHTML", testSendHTML),
@@ -35,151 +32,6 @@ class TestDataSender: XCTestCase {
("testSendRelatedAttachment", testSendRelatedAttachment)
]
func testDataCache() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
let group = DispatchGroup()
group.enter()
var sender: Sender?
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: ssl,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(_): XCTFail()
case .success(let socket):
let attachment = Attachment(data: data, mime: "application/json", name: "file.json")
let mail = Mail(from: from, to: [to], subject: #function, text: text, attachments: [attachment])
sender = Sender(socket: socket, pending: [mail], progress: nil) { (sent, failed) in
XCTAssertEqual(sent.count, 1)
XCTAssertEqual(failed.count, 0)
group.leave()
}
sender?.send()
}
}.login()
group.wait()
#if os(macOS)
let cached = sender?.dataSender.cache.object(forKey: data as AnyObject)
XCTAssertEqual(cached as? Data, data.base64EncodedData())
#else
let cached = sender?.dataSender.cache.object(forKey: NSData(data: data) as AnyObject)
XCTAssertEqual(cached as? NSData, NSData(data: data.base64EncodedData()))
#endif
x.fulfill()
}
func testFileCache() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
let group = DispatchGroup()
group.enter()
var sender: Sender?
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: ssl,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(_): XCTFail()
case .success(let socket):
let attachment = Attachment(filePath: imgFilePath)
let mail = Mail(from: from, to: [to], subject: #function, text: text, attachments: [attachment])
sender = Sender(socket: socket, pending: [mail], progress: nil) { (sent, failed) in
XCTAssertEqual(sent.count, 1)
XCTAssertEqual(failed.count, 0)
group.leave()
}
sender?.send()
}
}.login()
group.wait()
guard let file = FileHandle(forReadingAtPath: imgFilePath) else {
XCTFail()
return
}
let data = file.readDataToEndOfFile().base64EncodedData()
file.closeFile()
#if os(macOS)
let cached = sender?.dataSender.cache.object(forKey: imgFilePath as AnyObject)
XCTAssertEqual(cached as? Data, data)
#else
let cached = sender?.dataSender.cache.object(forKey: NSString(string: imgFilePath) as AnyObject)
XCTAssertEqual(cached as? NSData, NSData(data: data))
#endif
x.fulfill()
}
func testHTMLCache() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
let group = DispatchGroup()
group.enter()
var sender: Sender?
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: ssl,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(_): XCTFail()
case .success(let socket):
let attachment = Attachment(htmlContent: html)
let mail = Mail(from: from, to: [to], subject: #function, text: text, attachments: [attachment])
sender = Sender(socket: socket, pending: [mail], progress: nil) { (sent, failed) in
XCTAssertEqual(sent.count, 1)
XCTAssertEqual(failed.count, 0)
group.leave()
}
sender?.send()
}
}.login()
group.wait()
#if os(macOS)
let cached = sender?.dataSender.cache.object(forKey: html as AnyObject)
XCTAssertEqual(cached as? String, html.base64Encoded)
#else
let cached = sender?.dataSender.cache.object(forKey: NSString(string: html) as AnyObject)
XCTAssertEqual(cached as? NSString, NSString(string: html.base64Encoded))
#endif
x.fulfill()
}
func testSendData() {
let x = expectation(description: "Send mail with data attachment.")
let dataAttachment = Attachment(data: data, mime: "application/json", name: "file.json")
-154
View File
@@ -1,154 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import XCTest
@testable import SwiftSMTP
class TestLogin: XCTestCase {
static var allTests = [
("testBadCredentials", testBadCredentials),
("testBadPort", testBadPort),
("testLogin", testLogin),
("testPlain", testPlain),
("testPort0", testPort0),
("testSSL", testSSL)
]
func testBadCredentials() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
try Login(hostname: hostname,
email: email,
password: "bad password",
port: port,
ssl: nil,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(let error):
if let error = error as? SMTPError, case .badResponse = error {
x.fulfill()
} else {
XCTFail()
}
case .success(_): XCTFail()
}
}.login()
}
func testBadPort() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
try Login(hostname: hostname,
email: email,
password: password,
port: 1,
ssl: nil,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: 5) { (loginResult) in
switch loginResult {
case .failure(_): x.fulfill()
case .success(_): XCTFail()
}
}.login()
}
func testLogin() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: nil,
authMethods: [.login],
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(_): XCTFail()
case .success(_): x.fulfill()
}
}.login()
}
func testPlain() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: nil,
authMethods: [.plain],
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(_): XCTFail()
case .success(_): x.fulfill()
}
}.login()
}
func testPort0() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
try Login(hostname: hostname,
email: email,
password: password,
port: 0,
ssl: nil,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: 5) { (loginResult) in
switch loginResult {
case .failure(_): x.fulfill()
case .success(_): XCTFail()
}
}.login()
}
func testSSL() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
try Login(hostname: hostname,
email: email,
password: password,
port: port,
ssl: ssl,
authMethods: authMethods,
domainName: domainName,
accessToken: nil,
timeout: timeout) { (loginResult) in
switch loginResult {
case .failure(_): XCTFail()
case .success(_): x.fulfill()
}
}.login()
}
}
@@ -21,25 +21,24 @@ import XCTest
import Dispatch
#endif
class TestSender: XCTestCase {
class TestMailSender: XCTestCase {
static var allTests = [
("testBadEmail", testBadEmail),
("testIsValidEmail", testIsValidEmail),
("testSendMail", testSendMail),
("testSendMailInArray", testSendMailInArray),
("testSendMailNoRecipient", testSendMailNoRecipient),
("testSendNoMail", testSendNoMail),
("testSendMailsConcurrently", testSendMailsConcurrently),
("testSendMailWithCc", testSendMailWithCc),
("testSendMailToMultipleRecipients", testSendMailToMultipleRecipients),
("testSendMailWithBcc", testSendMailWithBcc),
("testSendMailWithCc", testSendMailWithCc),
("testSendMultipleMails", testSendMultipleMails),
("testSendMultipleMailsWithFail", testSendMultipleMailsWithFail),
("testSendMultipleRecipients", testSendMultipleRecipients)
("testSendNoMail", testSendNoMail)
]
func testBadEmail() {
let x = expectation(description: "Send a mail that will fail because of an invalid receiving address.")
let user = User(email: "")
let user = Mail.User(email: "")
let mail = Mail(from: user, to: [user])
smtp.send(mail) { (err) in
XCTAssertNotNil(err, "Sending mail to an invalid email address should return an error, but return nil.")
@@ -48,17 +47,6 @@ class TestSender: XCTestCase {
waitForExpectations(timeout: testDuration)
}
func testIsValidEmail() throws {
XCTAssert(try email.isValidEmail(), "\(email) should be a valid email.")
XCTAssertFalse(try "".isValidEmail(), "Blank email should be in invalid email.")
XCTAssertFalse(try "a".isValidEmail(), "`a` should be in invalid email.")
XCTAssertFalse(try "@gmail.com".isValidEmail(), "`@gmail.com` should be in invalid email.")
XCTAssertFalse(try "email@.com".isValidEmail(), "`email@.com` should be in invalid email.")
XCTAssertFalse(try "email@email".isValidEmail(), "`email@email` should be in invalid email.")
XCTAssertFalse(try "email@email.a".isValidEmail(), "`email@email.a` should be in invalid email.")
XCTAssertFalse(try "email@email.".isValidEmail(), "`email@email.` should be in invalid email.")
}
func testSendMail() {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
@@ -75,10 +63,10 @@ class TestSender: XCTestCase {
defer { waitForExpectations(timeout: testDuration) }
let mail = Mail(from: from, to: [to], subject: #function, text: text)
smtp.send([mail]) { (sent, failed) in
smtp.send([mail], completion: { _, failed in
XCTAssert(failed.isEmpty)
x.fulfill()
}
})
}
func testSendMailNoRecipient() {
@@ -86,40 +74,36 @@ class TestSender: XCTestCase {
defer { waitForExpectations(timeout: testDuration) }
let mail = Mail(from: from, to: [], subject: #function, text: text)
smtp.send([mail]) { (err) in
if let err = err.1[0].1 as? SMTPError, case .noRecipients = err {
x.fulfill()
} else {
XCTFail("Received different error other than SMTPError(.noRecipients) or no error at all.")
smtp.send(mail) { (error) in
guard let error = error as? SMTPError, case .noRecipients = error else {
XCTFail("Received different error other than SMTPError.noRecipients or no error at all.")
return
}
x.fulfill()
}
}
func testSendMailsConcurrently() {
let x = expectation(description: "Send multiple mails concurrently with seperate calls to `send`.")
let mail1 = Mail(from: from, to: [to], subject: "Send mails concurrently 1")
let mail2 = Mail(from: from, to: [to], subject: "Send mails concurrently 2")
let mails = [mail1, mail2]
let group = DispatchGroup()
for mail in mails {
group.enter()
smtp.send(mail) { (err) in
XCTAssertNil(err, String(describing: err))
group.leave()
}
}
group.wait()
x.fulfill()
waitForExpectations(timeout: testDuration)
}
func testSendMailWithCc() {
let x = expectation(description: "Send mail with Cc.")
let mail = Mail(from: from, to: [to], cc: [to2], subject: #function)
func testSendMailToMultipleRecipients() {
let x = expectation(description: "Send a single mail to multiple recipients.")
let mail = Mail(from: from, to: [to, to2], subject: #function)
smtp.send(mail) { (err) in
XCTAssertNil(err, String(describing: err))
x.fulfill()
@@ -137,6 +121,16 @@ class TestSender: XCTestCase {
waitForExpectations(timeout: testDuration)
}
func testSendMailWithCc() {
let x = expectation(description: "Send mail with Cc.")
let mail = Mail(from: from, to: [to], cc: [to2], subject: #function)
smtp.send(mail) { (err) in
XCTAssertNil(err, String(describing: err))
x.fulfill()
}
waitForExpectations(timeout: testDuration)
}
func testSendMultipleMails() {
let x = expectation(description: "Send multiple mails with one call to `send`.")
let mail1 = Mail(from: from, to: [to], subject: "Send multiple mails 1")
@@ -153,11 +147,10 @@ class TestSender: XCTestCase {
func testSendMultipleMailsWithFail() {
let x = expectation(description: "Send two mails, one of which will fail.")
let badUser = User(email: "")
let badUser = Mail.User(email: "")
let badMail = Mail(from: from, to: [badUser])
let goodMail = Mail(from: from, to: [to], subject: "Send multiple mails with fail")
smtp.send([badMail, goodMail]) { (sent, failed) in
smtp.send([badMail, goodMail], completion: { (sent, failed) in
guard sent.count == 1 && failed.count == 1 else {
XCTFail("Send did not complete with 1 mail sent and 1 mail failed.")
return
@@ -166,29 +159,17 @@ class TestSender: XCTestCase {
XCTAssertEqual(failed[0].0.id, badMail.id, "Invalid email returned does not match the invalid email sent.")
XCTAssertNotNil(failed[0].1, "Invalid email did not return an error when sending.")
x.fulfill()
}
waitForExpectations(timeout: testDuration)
}
func testSendMultipleRecipients() {
let x = expectation(description: "Send a single mail to multiple recipients.")
let mail = Mail(from: from, to: [to, to2], subject: #function)
smtp.send(mail) { (err) in
XCTAssertNil(err, String(describing: err))
x.fulfill()
}
})
waitForExpectations(timeout: testDuration)
}
func testSendNoMail() {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
smtp.send([]) { (sent, failed) in
smtp.send([], completion: { (sent, failed) in
XCTAssert(sent.isEmpty)
XCTAssert(failed.isEmpty)
x.fulfill()
}
})
}
}
+32 -23
View File
@@ -23,12 +23,12 @@ import XCTest
class TestMiscellaneous: XCTestCase {
static var allTests = [
("testBase64Encoded", testBase64Encoded),
("testMimeEncoded", testMimeEncoded),
("testDateFormatter", testDateFormatter),
("testMailHeaders", testMailHeaders),
("testMimeNoName", testMimeNoName),
("testMimeWithName", testMimeWithName),
("testBase64Encoded", testBase64Encoded),
("testMimeEncoded", testMimeEncoded)
("testMimeWithName", testMimeWithName)
]
}
@@ -45,6 +45,18 @@ extension TestMiscellaneous {
XCTAssertEqual(result3, randomText3Encoded, "result: \(result3) != expected: \(randomText3Encoded)")
}
func testBase64EncodedWithLineLimit() {
let result1 = randomText1.base64EncodedWithLineLimit
XCTAssertEqual(result1, randomText1EncodedWithLineLimit, "result: \(result1) != expected: \(randomText1Encoded)")
let result2 = randomText2.base64EncodedWithLineLimit
XCTAssertEqual(result2, randomText2EncodedWithLineLimit, "result: \(result2) != expected: \(randomText2Encoded)")
let result3 = randomText3.base64EncodedWithLineLimit
XCTAssertEqual(result3, randomText3EncodedWithLineLimit, "result: \(result3) != expected: \(randomText3Encoded)")
}
func testMimeEncoded() {
let result = "Water you up to?".mimeEncoded
let expected = "=?UTF-8?Q?Water_you_up_to??="
@@ -84,26 +96,8 @@ extension TestMiscellaneous {
XCTAssert(headers.contains("HEADER"), "Mail header did not contain \"header\".")
XCTAssert(headers.contains("val"), "Mail header did not contain \"val\".")
}
}
// User
extension TestMiscellaneous {
func testMimeNoName() {
let user = User(email: "bob@gmail.com")
let expected = "bob@gmail.com"
XCTAssertEqual(user.mime, expected, "result: \(user.mime) != expected: \(expected)")
}
func testMimeWithName() {
let user = User(name: "Bob", email: "bob@gmail.com")
let expected = "=?UTF-8?Q?Bob?= <bob@gmail.com>"
XCTAssertEqual(user.mime, expected, "result: \(user.mime) != expected: \(expected)")
}
}
// Utilities
extension TestMiscellaneous {
fileprivate func findMessageId(inString compareString: String) -> String {
private func findMessageId(inString compareString: String) -> String {
let messageIdHeaderPrefix = "MESSAGE-ID: <"
// example uuid: E621E1F8-C36C-495A-93FC-0C247A3E6E5F
let uuidRegEx = "[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}"
@@ -116,7 +110,7 @@ extension TestMiscellaneous {
let rangeLocation = 0
let rangeLength = NSString(string: compareString).length
let searchRange = NSMakeRange(rangeLocation, rangeLength)
let searchRange = NSRange(location: rangeLocation, length: rangeLength)
// run the regex
let matches = regex.matches(in: compareString, options: .withoutAnchoringBounds, range: searchRange)
@@ -131,3 +125,18 @@ extension TestMiscellaneous {
}
}
}
// User
extension TestMiscellaneous {
func testMimeNoName() {
let user = Mail.User(email: "bob@gmail.com")
let expected = "bob@gmail.com"
XCTAssertEqual(user.mime, expected, "result: \(user.mime) != expected: \(expected)")
}
func testMimeWithName() {
let user = Mail.User(name: "Bob", email: "bob@gmail.com")
let expected = "=?UTF-8?Q?Bob?= <bob@gmail.com>"
XCTAssertEqual(user.mime, expected, "result: \(user.mime) != expected: \(expected)")
}
}
+133 -60
View File
@@ -18,82 +18,155 @@ import XCTest
@testable import SwiftSMTP
class TestSMTPSocket: XCTestCase {
static var allTests: [(String, (TestSMTPSocket) -> () throws -> Void)] {
return [
("testGetResponseCode", testGetResponseCode),
("testGetResponseCodeBadResponse", testGetResponseCodeBadResponse),
("testGetResponseCodeBlankReponse", testGetResponseCodeBlankReponse),
("testGetResponseMessageGood", testGetResponseMessageGood),
("testGetResponseMessageTooShort", testGetResponseMessageTooShort),
("testParseResponsesGood", testParseResponsesGood),
("testParseResponsesBad", testParseResponsesBad)
]
}
}
static var allTests = [
("testBadCredentials", testBadCredentials),
("testBadPort", testBadPort),
("testLogin", testLogin),
("testPlain", testPlain),
("testPort0", testPort0),
("testSSL", testSSL)
]
extension TestSMTPSocket {
func testGetResponseCode() throws {
let responseCode = try SMTPSocket.getResponseCode("250-smtp.gmail.com at your service, [66.68.56.204]", command: .ehlo(""))
let expected = ResponseCode(250)
XCTAssertEqual(responseCode, expected, "result: \(responseCode) != expected: \(expected)")
}
func testBadCredentials() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
func testGetResponseCodeBadResponse() {
do {
_ = try SMTPSocket.getResponseCode("250-SIZE 35882577", command: .starttls)
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: "bad password",
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
XCTFail()
x.fulfill()
} catch {
guard let err = error as? SMTPError, case .badResponse = err else {
XCTFail("Error should be SMTPError(.badResponse) but received no error or incorrect error.")
return
if case SMTPError.badResponse = error {
x.fulfill()
} else {
XCTFail(String(describing: error))
x.fulfill()
}
}
}
func testGetResponseCodeBlankReponse() {
func testBadPort() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket.getResponseCode("", command: .auth(.cramMD5, "credentials"))
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: 1,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: 5
)
XCTFail()
x.fulfill()
} catch {
guard let err = error as? SMTPError, case .badResponse = err else {
XCTFail("Error should be SMTPError(.badResponse) but received no error or incorrect error.")
return
}
x.fulfill()
}
}
}
extension TestSMTPSocket {
func testGetResponseMessageGood() {
let responseMessage = SMTPSocket.getResponseMessage("250 OK")
XCTAssertEqual(responseMessage, "OK", "result: \(responseMessage) != expected: \"OK\"")
}
func testLogin() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
func testGetResponseMessageTooShort() {
let responseMessage = SMTPSocket.getResponseMessage("NO")
XCTAssertEqual(responseMessage, "", "result: \(responseMessage) != expected: \"\"")
}
}
extension TestSMTPSocket {
func testParseResponsesGood() throws {
let ehloResponsesGood = "250 OK\(CRLF)250 GREAT\(CRLF)"
let responses = try SMTPSocket.parseResponses(ehloResponsesGood, command: .ehlo(domainName))
guard responses.count == 2 else {
XCTFail("Should return 2 responses but returned \(responses.count)")
return
}
XCTAssertEqual(responses[0].response, "250 OK", "First response: \(responses[0].response) != expected \"250 OK\"")
XCTAssertEqual(responses[1].response, "250 GREAT", "Second response: \(responses[1].response) != expected \"250 GREAT\"")
}
func testParseResponsesBad() {
let ehloResponsesBad = "999 BAD"
do {
_ = try SMTPSocket.parseResponses(ehloResponsesBad, command: .ehlo(domainName))
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: [AuthMethod.login.rawValue: .login],
domainName: domainName,
timeout: timeout
)
x.fulfill()
} catch {
guard let err = error as? SMTPError, case .badResponse = err else {
XCTFail("Should return SMTPError(.badResponse), but returned different error or no error.")
return
}
XCTFail(String(describing: error))
x.fulfill()
}
}
func testPlain() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: [AuthMethod.plain.rawValue: .plain],
domainName: domainName,
timeout: timeout
)
x.fulfill()
} catch {
XCTFail(String(describing: error))
x.fulfill()
}
}
func testPort0() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: 0,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
XCTFail()
x.fulfill()
} catch {
x.fulfill()
}
}
func testSSL() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: tlsConfiguration,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
x.fulfill()
} catch {
XCTFail(String(describing: error))
x.fulfill()
}
}
}
+127
View File
@@ -0,0 +1,127 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import XCTest
@testable import SwiftSMTP
class TestTLSMode: XCTestCase {
static var allTests = [
("testNormal", testNormal),
/*("testIgnoreTLS", testIgnoreTLS),*/
("testRequireTLS", testRequireTLS),
("testRequireSTARTTLS", testRequireSTARTTLS)
]
func testNormal() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .normal,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
expectation.fulfill()
} catch {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
// This test is for a mail server that requires STARTTLS authentication. The current mail server being used for CI builds does not require STARTTLS for non-SSL ports. So this test cannot pass successfully.
/*
func testIgnoreTLS() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .ignoreTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
XCTFail()
expectation.fulfill()
} catch {
if case SMTPError.noAuthMethodsOrRequiresTLS = error {
expectation.fulfill()
} else {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
}
*/
func testRequireTLS() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: 465,
tlsMode: .requireTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
expectation.fulfill()
} catch {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
func testRequireSTARTTLS() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
expectation.fulfill()
} catch {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
}
@@ -1,61 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
#if os(OSX)
import XCTest
class VerifyLinuxTextCount: XCTestCase {
func verifyLinuxTextCount() {
var linuxCount: Int
var darwinCount: Int
// TestAttachment
linuxCount = TestAttachment.allTests.count
darwinCount = Int(TestAttachment.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestAttachment.allTests")
// TestAuthEncoder
linuxCount = TestAuthEncoder.allTests.count
darwinCount = Int(TestAuthEncoder.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestAuthEncoder.allTests")
// TestDataSender
linuxCount = TestDataSender.allTests.count
darwinCount = Int(TestDataSender.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestDataSender.allTests")
// TestLogin
linuxCount = TestLogin.allTests.count
darwinCount = Int(TestLogin.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestLogin.allTests")
// TestMiscellaneous
linuxCount = TestMiscellaneous.allTests.count
darwinCount = Int(TestMiscellaneous.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestMiscellaneous.allTests")
// TestSender
linuxCount = TestSender.allTests.count
darwinCount = Int(TestSender.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestSender.allTests")
// TestSMTPSocket
linuxCount = TestSMTPSocket.allTests.count
darwinCount = Int(TestSMTPSocket.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestSMTPSocket.allTests")
}
}
#endif
+28 -56
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enums Reference</title>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enums Reference"></a>
<a title="Enumerations Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Enums Reference
Enumerations Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Enums</h1>
<p>The following enums are available globally.</p>
<div class="section-content top-matter">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</div>
</section>
@@ -110,37 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP5Ports"></a>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP5Ports">Ports</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Common <code><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
<a href="Enums/Ports.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP10AuthMethod"></a>
<a name="/s:9SwiftSMTP10AuthMethodO"></a>
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP10AuthMethod">AuthMethod</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO">AuthMethod</a>
</code>
</div>
<div class="height-container">
@@ -156,23 +132,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP9SMTPError"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO"></a>
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP9SMTPError">SMTPError</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO">SMTPError</a>
</code>
</div>
<div class="height-container">
@@ -188,7 +160,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -203,8 +175,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+33 -41
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>AuthMethod Enum Reference</title>
<title>AuthMethod Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a title="AuthMethod Enum Reference"></a>
<a title="AuthMethod Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
AuthMethod Enum Reference
AuthMethod Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>AuthMethod</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_">cramMD5</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_">login</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_">plain</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_">xoauth2</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
</code>
</div>
<div class="height-container">
@@ -227,7 +219,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
</div>
</div>
@@ -242,8 +234,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
-188
View File
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ports Enum Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a title="Ports Enum Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Ports Enum Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Ports</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
<p>Common <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/tls" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_">tls</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Default <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">tls</span> <span class="o">=</span> <span class="mi">587</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3sslFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/ssl" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3sslFMS0_S0_">ssl</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p><code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> used to connect securely.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">ssl</span> <span class="o">=</span> <span class="mi">465</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
+86 -124
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTPError Enum Reference</title>
<title>SMTPError Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a title="SMTPError Enum Reference"></a>
<a title="SMTPError Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTPError Enum Reference
SMTPError Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTPError</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_">base64DecodeFail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail(string:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF">base64DecodeFail(string:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_">md5HashChallengeFail</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_"></a>
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_">fileNotFound</a>
<a name="/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/fileNotFound(path:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF">fileNotFound(path:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">fileNotFound</span><span class="p">(</span><span class="nv">path</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">fileNotFound</span><span class="p">(</span><span class="nv">path</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_"></a>
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_">noSupportedAuthMethods</a>
<a name="/s:9SwiftSMTP9SMTPErrorO26noAuthMethodsOrRequiresTLSyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/noAuthMethodsOrRequiresTLS(hostname:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO26noAuthMethodsOrRequiresTLSyACSS_tcACmF">noAuthMethodsOrRequiresTLS(hostname:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -220,63 +212,26 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The preferred <code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s could not be found. Connecting with <code><a href="../Structs/SSL.html">SSL</a></code>
may be required.</p>
<p>The preferred <code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s could not be found, or your server is sending back a STARTTLS command and requires a connection upgrade.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">noSupportedAuthMethods</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">noAuthMethodsOrRequiresTLS</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/noAccessToken" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_">noAccessToken</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Attempted to login using <code>XOAUTH2</code> but <code><a href="../Structs/SMTP.html">SMTP</a></code> instance was initialized
without an access token.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">noAccessToken</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12noRecipientsFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF"></a>
<a name="//apple_ref/swift/Element/noRecipients" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12noRecipientsFMS0_S0_">noRecipients</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF">noRecipients</a>
</code>
</div>
<div class="height-container">
@@ -291,23 +246,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">noRecipients</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">noRecipients</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF"></a>
<a name="//apple_ref/swift/Element/createEmailRegexFailed" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_">createEmailRegexFailed</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF">createEmailRegexFailed</a>
</code>
</div>
<div class="height-container">
@@ -322,23 +273,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_"></a>
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_">badResponse</a>
<a name="/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF"></a>
<a name="//apple_ref/swift/Element/badResponse(command:response:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF">badResponse(command:<wbr>response:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -353,23 +300,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_">convertDataUTF8Fail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail(data:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF">convertDataUTF8Fail(data:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -384,23 +327,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_"></a>
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_">invalidEmail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/invalidEmail(email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF">invalidEmail(email:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -408,30 +347,53 @@ without an access token.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Invalid email provided for <code><a href="../Structs/User.html">User</a></code>.</p>
<p>Invalid email provided for <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:vO9SwiftSMTP9SMTPError11descriptionSS"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF"></a>
<a name="//apple_ref/swift/Element/requiredSTARTTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF">requiredSTARTTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>STARTTLS was required but the server did not request it.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requiredSTARTTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:vO9SwiftSMTP9SMTPError11descriptionSS">description</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
@@ -446,7 +408,7 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
@@ -461,8 +423,8 @@ without an access token.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+39 -81
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structs Reference</title>
<title>Structures Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
<a title="Structs Reference"></a>
<a title="Structures Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Structs Reference
Structures Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Structs</h1>
<p>The following structs are available globally.</p>
<div class="section-content top-matter">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP10Attachment"></a>
<a name="/s:9SwiftSMTP10AttachmentV"></a>
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP10Attachment">Attachment</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV">Attachment</a>
</code>
</div>
<div class="height-container">
@@ -129,23 +133,20 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Attachment</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP4Mail"></a>
<a name="/s:9SwiftSMTP4MailV"></a>
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP4Mail">Mail</a>
<a class="token" href="#/s:9SwiftSMTP4MailV">Mail</a>
</code>
</div>
<div class="height-container">
@@ -161,23 +162,19 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP4SMTP"></a>
<a name="/s:9SwiftSMTP0B0V"></a>
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP4SMTP">SMTP</a>
<a class="token" href="#/s:9SwiftSMTP0B0V">SMTP</a>
</code>
</div>
<div class="height-container">
@@ -185,7 +182,7 @@ Different SMTP servers have different attachment size limits.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
<a href="Structs/SMTP.html" class="slightly-smaller">See more</a>
</div>
@@ -193,23 +190,19 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP3SSL"></a>
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP3SSL">SSL</a>
<a name="/s:9SwiftSMTP16TLSConfigurationV"></a>
<a name="//apple_ref/swift/Struct/TLSConfiguration" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV">TLSConfiguration</a>
</code>
</div>
<div class="height-container">
@@ -217,50 +210,15 @@ Different SMTP servers have different attachment size limits.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Configuration to connect securely through SSL/TLS.
Create an <code>SSL</code> based on your requirements and pass it along to your <code><a href="Structs/SMTP.html">SMTP</a></code>
struct as an initialization parameter.
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></p>
<p>Configuration for connecting with TLS. For more info, see <a href="https://github.com/Kitura/BlueSSLService">https://github.com/Kitura/BlueSSLService</a>.</p>
<a href="Structs/SSL.html" class="slightly-smaller">See more</a>
<a href="Structs/TLSConfiguration.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP4User"></a>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP4User">User</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a sender or receiver of an email.</p>
<a href="Structs/User.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">TLSConfiguration</span></code></pre>
</div>
</div>
@@ -275,8 +233,8 @@ struct as an initialization parameter.
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+73 -41
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Attachment Struct Reference</title>
<title>Attachment Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a title="Attachment Struct Reference"></a>
<a title="Attachment Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Attachment Struct Reference
Attachment Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,13 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Attachment</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Attachment</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
</div>
</div>
@@ -118,9 +123,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_"></a>
<a name="/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc"></a>
<a name="//apple_ref/swift/Method/init(data:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_">init(data:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc">init(data:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -135,12 +140,12 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
@@ -206,7 +211,7 @@ Different SMTP servers have different attachment size limits.</p>
</td>
<td>
<div>
<p>Additional headers for the <code>Mail</code>. Header keys
<p>Additional headers for the <code><a href="../Structs/Mail.html">Mail</a></code>. Header keys
are capitalized and duplicate keys will
overwrite each other. Defaults to none. The
following will be ignored: CONTENT-TYPE,
@@ -236,9 +241,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_"></a>
<a name="/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc"></a>
<a name="//apple_ref/swift/Method/init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_">init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc">init(filePath:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -253,12 +258,12 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
@@ -354,9 +359,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_"></a>
<a name="/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc"></a>
<a name="//apple_ref/swift/Method/init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_">init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc">init(htmlContent:<wbr>characterSet:<wbr>alternative:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -371,11 +376,11 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
@@ -454,6 +459,33 @@ Different SMTP servers have different attachment size limits.</p>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns <code>true</code> if the <code>Attachment</code>s are equal.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
@@ -462,8 +494,8 @@ Different SMTP servers have different attachment size limits.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+371 -57
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mail Struct Reference</title>
<title>Mail Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
<a title="Mail Struct Reference"></a>
<a title="Mail Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Mail Struct Reference
Mail Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Mail</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
</div>
</div>
@@ -117,9 +121,281 @@
<li class="item">
<div>
<code>
<a name="/s:vV9SwiftSMTP4Mail2idSS"></a>
<a name="/s:9SwiftSMTP4MailV4uuidSSvp"></a>
<a name="//apple_ref/swift/Property/uuid" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSvp">uuid</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A UUID for the mail.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">uuid</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4fromAC4UserVvp"></a>
<a name="//apple_ref/swift/Property/from" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAC4UserVvp">from</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2toSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/to" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAC4UserVGvp">to</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/cc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp">cc</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/bcc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp">bcc</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV7subjectSSvp"></a>
<a name="//apple_ref/swift/Property/subject" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSvp">subject</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4textSSvp"></a>
<a name="//apple_ref/swift/Property/text" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSvp">text</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Text of the <code>Mail</code>. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">text</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp"></a>
<a name="//apple_ref/swift/Property/attachments" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp">attachments</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are alternatives to plain
text, the last one will be used as the alternative (all the <code>Attachments</code> will still be sent). Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp"></a>
<a name="//apple_ref/swift/Property/alternative" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp">alternative</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Attachment that is an alternative to plain text.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">alternative</span><span class="p">:</span> <span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp"></a>
<a name="//apple_ref/swift/Property/additionalHeaders" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp">additionalHeaders</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Additional headers for the <code>Mail</code>. 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.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">String</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2idSSvp"></a>
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
<a class="token" href="#/s:vV9SwiftSMTP4Mail2idSS">id</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSvp">id</a>
</code>
</div>
<div class="height-container">
@@ -134,7 +410,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">id</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">id</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
@@ -144,9 +420,36 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGVs10DictionarySSSS__S0_"></a>
<a name="/s:9SwiftSMTP4MailV8hostnameSSvp"></a>
<a name="//apple_ref/swift/Property/hostname" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSvp">hostname</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Hostname from the email address.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc"></a>
<a name="//apple_ref/swift/Method/init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGVs10DictionarySSSS__S0_">init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc">init(from:<wbr>to:<wbr>cc:<wbr>bcc:<wbr>subject:<wbr>text:<wbr>attachments:<wbr>additionalHeaders:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -161,14 +464,14 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:])</span></code></pre>
</div>
</div>
@@ -176,19 +479,6 @@
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>hostname</em>
</code>
</td>
<td>
<div>
<p>Hostname of the SMTP server to connect to. Should not
include any scheme&ndash;ie <code>smtp.example.com</code> is valid.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
@@ -197,7 +487,7 @@
</td>
<td>
<div>
<p>The <code>User</code> that the <code>Mail</code> will be sent from.</p>
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
</div>
</td>
</tr>
@@ -209,7 +499,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to send the <code>Mail</code> to.</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
</div>
</td>
</tr>
@@ -221,7 +511,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to cc. Defaults to none.</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -233,7 +523,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to bcc. Defaults to none.</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -269,11 +559,9 @@
</td>
<td>
<div>
<p>Array of <code>Attachment</code>s for the <code>Mail</code>. If the <code>Mail</code>
has multiple <code>Attachment</code>s that are alternatives to
to plain text, the last one will be used as the
alternative (all the <code>Attachments</code> will still be
sent). Defaults to none.</p>
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are
alternatives to plain text, the last one will be used as the alternative (all the <code>Attachments</code> will still
be sent). Defaults to none.</p>
</div>
</td>
</tr>
@@ -285,11 +573,9 @@
</td>
<td>
<div>
<p>Additional headers for the <code>Mail</code>. 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.</p>
<p>Additional headers for the <code>Mail</code>. 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.</p>
</div>
</td>
</tr>
@@ -299,6 +585,34 @@
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV"></a>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV">User</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a sender or receiver of an email.</p>
<a href="../Structs/Mail/User.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
@@ -307,8 +621,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+246
View File
@@ -0,0 +1,246 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
User Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4nameSSSgvp"></a>
<a name="//apple_ref/swift/Property/name" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4nameSSSgvp">name</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV5emailSSvp"></a>
<a name="//apple_ref/swift/Property/email" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV5emailSSvp">email</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s email address.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc">init(name:<wbr>email:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s email address.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
+111 -96
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTP Struct Reference</title>
<title>SMTP Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
<a title="SMTP Struct Reference"></a>
<a title="SMTP Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTP Struct Reference
SMTP Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,15 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTP</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
</div>
</div>
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
</div>
</section>
@@ -117,9 +121,37 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSu_S0_"></a>
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSu_S0_">init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)</a>
<a name="/s:9SwiftSMTP0B0V7TLSModeO"></a>
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO">TLSMode</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>TLSMode enum for what form of connection security to enforce.</p>
<a href="../Structs/SMTP/TLSMode.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc"></a>
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:tlsMode:tlsConfiguration:authMethods:domainName:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc">init(hostname:<wbr>email:<wbr>password:<wbr>port:<wbr>tlsMode:<wbr>tlsConfiguration:<wbr>authMethods:<wbr>domainName:<wbr>timeout:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -133,12 +165,9 @@
<p>Note:</p>
<ul>
<li>Some servers like Gmail support IPv6, and if your network does
not, you will first attempt to connect via IPv6, then timeout, and
fall back to IPv4. You can avoid this by disabling IPv6 on your
machine.</li>
<li>You may need to enable access for less secure apps in your account
on the SMTP server.</li>
<li>You may need to enable access for less secure apps for your account on the SMTP server.</li>
<li>Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.</li>
</ul>
</div>
@@ -148,15 +177,15 @@ on the SMTP server.</li>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">port</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span> <span class="o">=</span> <span class="kt"><a href="../Enums/Ports.html">Ports</a></span><span class="o">.</span><span class="n">tls</span><span class="o">.</span><span class="n">rawValue</span><span class="p">,</span>
<span class="nv">ssl</span><span class="p">:</span> <span class="kt"><a href="../Structs/SSL.html">SSL</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
<span class="nv">accessToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">port</span><span class="p">:</span> <span class="kt">Int32</span> <span class="o">=</span> <span class="mi">587</span><span class="p">,</span>
<span class="nv">tlsMode</span><span class="p">:</span> <span class="kt"><a href="../Structs/SMTP/TLSMode.html">TLSMode</a></span> <span class="o">=</span> <span class="o">.</span><span class="n">requireSTARTTLS</span><span class="p">,</span>
<span class="nv">tlsConfiguration</span><span class="p">:</span> <span class="kt"><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -172,15 +201,14 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Hostname of the SMTP server to connect to. Should not
include any scheme&ndash;ie <code>smtp.example.com</code> is valid.</p>
<p>Hostname of the SMTP server to connect to, i.e. <code>smtp.example.com</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>user</em>
<em>email</em>
</code>
</td>
<td>
@@ -197,7 +225,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Password to log in to server.</p>
<p>Password to log in to server, or access token if using XOAUTH2 authorization method.</p>
</div>
</td>
</tr>
@@ -209,24 +237,32 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p><code>Port</code> to connect to the server on. Defaults to <code>587</code>.</p>
<p>Port to connect to the server on. Defaults to <code>465</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>ssl</em>
<em>tlsMode</em>
</code>
</td>
<td>
<div>
<p><code>SSL</code> containing configuration info for connecting securely
through SSL/TLS. If your server has the option to use SSL,
Swift-SMTP will automatically attempt to upgrade the
connection. If you don&rsquo;t provide an SSL configuration,
Swift-SMTP defaults to an SSL configuration with no backing
certificates. See <code>SSL</code> for other configuration options.</p>
<p>TLSMode <code>enum</code> indicating what form of connection security to use.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>tlsConfiguration</em>
</code>
</td>
<td>
<div>
<p><code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> used to connect with TLS. If nil, a configuration with no backing
certificates is used. See <code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> for other configuration options.</p>
</div>
</td>
</tr>
@@ -238,8 +274,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p><code>AuthMethod</code>s to use to log in to the
server. Defaults to <code>CRAM-MD5</code>, <code>LOGIN</code>, and <code>PLAIN</code>.</p>
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. If blank, tries all supported methods.</p>
</div>
</td>
</tr>
@@ -251,21 +286,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Client domain name used when communicating with the
server. Defaults to <code>localhost</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>accessToken</em>
</code>
</td>
<td>
<div>
<p>Access token used if logging in through <code>XOAUTH2</code>.
(optional)</p>
<p>Client domain name used when communicating with the server. Defaults to <code>localhost</code>.</p>
</div>
</td>
</tr>
@@ -277,8 +298,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>How long to try connecting to the server to before
returning an error. Defaults to <code>10</code> seconds.</p>
<p>How long to try connecting to the server to before returning an error. Defaults to <code>10</code> seconds.</p>
</div>
</td>
</tr>
@@ -291,9 +311,9 @@ on the SMTP server.</li>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_"></a>
<a name="/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF"></a>
<a name="//apple_ref/swift/Method/send(_:completion:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_">send(_:completion:)</a>
<a class="token" href="#/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF">send(_:<wbr>completion:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -308,7 +328,7 @@ on the SMTP server.</li>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -324,7 +344,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p><code>Mail</code> object to send.</p>
<p><code><a href="../Structs/Mail.html">Mail</a></code> object to send.</p>
</div>
</td>
</tr>
@@ -336,8 +356,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Callback when sending finishes. <code>Error</code> is nil on
success. (optional)</p>
<p>Callback when sending finishes. <code>Error</code> is nil on success. (optional)</p>
</div>
</td>
</tr>
@@ -350,9 +369,9 @@ on the SMTP server.</li>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_"></a>
<a name="/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF"></a>
<a name="//apple_ref/swift/Method/send(_:progress:completion:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_">send(_:progress:completion:)</a>
<a class="token" href="#/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF">send(_:<wbr>progress:<wbr>completion:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -366,15 +385,14 @@ on the SMTP server.</li>
<p>Note:</p>
<ul>
<li>If any of the emails addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code>
are invalid, the entire mail will not send and return an
<code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s,
the whole sending process will not stop until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s
are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one.
To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them in separate calls to
<code>send</code>.</li>
<li>Each call to <code>send</code> will first log in to your server, attempt to send the mails, then closes the
connection. Pass in an array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send them all in one session.</li>
<li>If any of the email addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code> are invalid, the entire mail will not
send and return an <code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s, the whole sending process will continue
until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one. To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them
in separate calls to <code>send</code>.</li>
</ul>
</div>
@@ -384,9 +402,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
<span class="nv">progress</span><span class="p">:</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">completion</span><span class="p">:</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
<span class="nv">progress</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">completion</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -402,7 +420,7 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</td>
<td>
<div>
<p>Array of <code>Mail</code>s to send.</p>
<p>Array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send.</p>
</div>
</td>
</tr>
@@ -414,9 +432,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</td>
<td>
<div>
<p>(<code>Mail</code>, <code>Error</code>) callback after each <code>Mail</code> is sent.
<code>Mail</code> is the <code>Mail</code> sent and <code>Error</code> is the error if it
failed. (optional)</p>
<p>(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="../Structs/Mail.html">Mail</a></code> is sent. <code><a href="../Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is
the error if it failed. (optional)</p>
</div>
</td>
</tr>
@@ -428,11 +445,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</td>
<td>
<div>
<p>([<code>Mail</code>], [(<code>Mail</code>, <code>Error</code>)]) callback after all
<code>Mail</code>s have been attempted. [<code>Mail</code>] is an array of
successfully sent <code>Mail</code>s. [(<code>Mail</code>, <code>Error</code>)] is an
array of failed <code>Mail</code>s and their corresponding
<code>Error</code>s. (optional)</p>
<p>([<code><a href="../Structs/Mail.html">Mail</a></code>], [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="../Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="../Structs/Mail.html">Mail</a></code>] is an
array of successfully sent <code><a href="../Structs/Mail.html">Mail</a></code>s. [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="../Structs/Mail.html">Mail</a></code>s and their
corresponding <code>Error</code>s. (optional)</p>
</div>
</td>
</tr>
@@ -450,8 +465,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+242
View File
@@ -0,0 +1,242 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>TLSMode Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
<a title="TLSMode Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
TLSMode Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>TLSMode</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
</div>
</div>
<p>TLSMode enum for what form of connection security to enforce.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF"></a>
<a name="//apple_ref/swift/Element/normal" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF">normal</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">normal</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/ignoreTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF">ignoreTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ignoreTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF">requireTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>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.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireSTARTTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF">requireSTARTTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>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.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireSTARTTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SSL Struct Reference</title>
<title>TLSConfiguration Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -14,9 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
<a name="//apple_ref/swift/Struct/TLSConfiguration" class="dashAnchor"></a>
<a title="SSL Struct Reference"></a>
<a title="TLSConfiguration Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SSL Struct Reference
TLSConfiguration Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,18 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>SSL</h1>
<div class="section-content top-matter">
<h1>TLSConfiguration</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">TLSConfiguration</span></code></pre>
</div>
</div>
<p>Configuration to connect securely through SSL/TLS.
Create an <code>SSL</code> based on your requirements and pass it along to your <code><a href="../Structs/SMTP.html">SMTP</a></code>
struct as an initialization parameter.
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></p>
<p>Configuration for connecting with TLS. For more info, see <a href="https://github.com/Kitura/BlueSSLService">https://github.com/Kitura/BlueSSLService</a>.</p>
</div>
</section>
@@ -120,9 +121,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT15withCipherSuiteGSqSS_34clientAllowsSelfSignedCertificatesSb_S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc"></a>
<a name="//apple_ref/swift/Method/init(withCipherSuite:clientAllowsSelfSignedCertificates:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT15withCipherSuiteGSqSS_34clientAllowsSelfSignedCertificatesSb_S0_">init(withCipherSuite:clientAllowsSelfSignedCertificates:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc">init(withCipherSuite:<wbr>clientAllowsSelfSignedCertificates:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -137,7 +138,8 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCipherSuite</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCipherSuite</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -178,9 +180,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT25withCACertificateFilePathGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV25withCACertificateFilePath016usingCertificateF00d3KeyF00H15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc"></a>
<a name="//apple_ref/swift/Method/init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT25withCACertificateFilePathGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_">init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV25withCACertificateFilePath016usingCertificateF00d3KeyF00H15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateFilePath:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -195,7 +197,11 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateFilePath</span> <span class="nv">caCertificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateFilePath</span> <span class="nv">caCertificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -272,9 +278,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT26withCACertificateDirectoryGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV26withCACertificateDirectory20usingCertificateFile0d3KeyI00G15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc"></a>
<a name="//apple_ref/swift/Method/init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT26withCACertificateDirectoryGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_">init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV26withCACertificateDirectory20usingCertificateFile0d3KeyI00G15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateDirectory:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -291,7 +297,11 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateDirectory</span> <span class="nv">caCertificateDirPath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateDirectory</span> <span class="nv">caCertificateDirPath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -368,9 +378,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb34clientAllowsSelfSignedCertificatesSb11cipherSuiteGSqSS__S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV17withChainFilePath0D8Password20usingSelfSignedCerts012clientAllowsjK12Certificates11cipherSuiteACSSSg_AIS2bAItcfc"></a>
<a name="//apple_ref/swift/Method/init(withChainFilePath:withPassword:usingSelfSignedCerts:clientAllowsSelfSignedCertificates:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb34clientAllowsSelfSignedCertificatesSb11cipherSuiteGSqSS__S0_">init(withChainFilePath:withPassword:usingSelfSignedCerts:clientAllowsSelfSignedCertificates:cipherSuite:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV17withChainFilePath0D8Password20usingSelfSignedCerts012clientAllowsjK12Certificates11cipherSuiteACSSSg_AIS2bAItcfc">init(withChainFilePath:<wbr>withPassword:<wbr>usingSelfSignedCerts:<wbr>clientAllowsSelfSignedCertificates:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -387,7 +397,11 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withChainFilePath</span> <span class="nv">chainFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">withPassword</span> <span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withChainFilePath</span> <span class="nv">chainFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">withPassword</span> <span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -431,6 +445,18 @@ struct as an initialization parameter.
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>clientAllowsSelfSignedCertificates</em>
</code>
</td>
<td>
<div>
<p>True if, as a client, connections to self-signed servers are allowed</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
@@ -454,7 +480,7 @@ struct as an initialization parameter.
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Method/init(withPEMCertificateString:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/">init(withPEMCertificateString:usingSelfSignedCerts:cipherSuite:)</a>
<a class="token" href="#/">init(withPEMCertificateString:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -465,14 +491,6 @@ struct as an initialization parameter.
<p>Initialize a configuration using a <code>PEM formatted certificate in String form</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
</div>
</div>
</section>
</div>
</li>
@@ -484,8 +502,8 @@ struct as an initialization parameter.
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
-188
View File
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Struct Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Struct Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
User Struct Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_">init(name:email:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>Display name for the user. (optional)</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>Email address for the user.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
+55 -23
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Typealiases Reference</title>
<title>Type Aliases Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
<a title="Typealiases Reference"></a>
<a title="Type Aliases Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Typealiases Reference
Type Aliases Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Typealiases</h1>
<p>The following typealiases are available globally.</p>
<div class="section-content top-matter">
<h1>Type Aliases</h1>
<p>The following type aliases are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4Port"></a>
<a name="//apple_ref/swift/Alias/Port" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4Port">Port</a>
<a name="/s:9SwiftSMTP8Progressa"></a>
<a name="//apple_ref/swift/Alias/Progress" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP8Progressa">Progress</a>
</code>
</div>
<div class="height-container">
@@ -120,14 +124,42 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Port to connect to SMTP server with.</p>
<p>(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="Structs/Mail.html">Mail</a></code> is sent. <code><a href="Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is the error if it failed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Port</span> <span class="o">=</span> <span class="kt">Int32</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="p">((</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10Completiona"></a>
<a name="//apple_ref/swift/Alias/Completion" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10Completiona">Completion</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>([<code><a href="Structs/Mail.html">Mail</a></code>], [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="Structs/Mail.html">Mail</a></code>] is an array of successfully
sent <code><a href="Structs/Mail.html">Mail</a></code>s. [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="Structs/Mail.html">Mail</a></code>s and their corresponding <code>Error</code>s.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="p">(([</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">],</span> <span class="p">[(</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">)])</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
@@ -142,8 +174,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+28 -1
View File
@@ -1 +1,28 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="136" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h93v20H0z"/><path fill="#4c1" d="M93 0h43v20H93z"/><path fill="url(#b)" d="M0 0h136v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="46.5" y="15" fill="#010101" fill-opacity=".3">documentation</text><text x="46.5" y="14">documentation</text><text x="113.5" y="15" fill="#010101" fill-opacity=".3">100%</text><text x="113.5" y="14">100%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="a">
<rect width="136" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#a)">
<path fill="#555" d="M0 0h93v20H0z"/>
<path fill="#4c1" d="M93 0h43v20H93z"/>
<path fill="url(#b)" d="M0 0h136v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="475" y="140" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
100%
</text>
<text x="1135" y="140" transform="scale(.1)" textLength="330">
100%
</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 1.1 KiB

+36 -9
View File
@@ -63,6 +63,10 @@ a {
a:hover, a:focus {
outline: 0;
text-decoration: underline; }
a.discouraged {
text-decoration: line-through; }
a.discouraged:hover, a.discouraged:focus {
text-decoration: underline line-through; }
table {
background: #fff;
@@ -90,10 +94,10 @@ pre {
code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
p > code, li > code {
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
background: #f7f7f7;
padding: .2em; }
p > code:before, p > code:after, li > code:before, li > code:after {
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
letter-spacing: -.2em;
content: "\00a0"; }
@@ -107,7 +111,6 @@ pre code {
@media (min-width: 768px) {
.content-wrapper {
flex-direction: row; } }
.header {
display: flex;
padding: 8px;
@@ -153,7 +156,6 @@ pre code {
word-wrap: normal;
background: #fbfbfb;
border-right: 1px solid #ddd; } }
.nav-groups {
list-style-type: none;
padding-left: 0; }
@@ -184,7 +186,6 @@ pre code {
order: 2;
flex: 1;
padding-bottom: 60px; } }
.section {
padding: 0 32px;
border-bottom: 1px solid #ddd; }
@@ -197,6 +198,8 @@ pre code {
.section-name {
color: #666;
display: block; }
.section-name p {
margin-bottom: inherit; }
.declaration .highlight {
overflow-x: initial;
@@ -215,6 +218,22 @@ pre code {
content: "";
display: block; }
.section-name-container {
position: relative; }
.section-name-container .section-name-link {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0; }
.section-name-container .section-name {
position: relative;
pointer-events: none;
z-index: 1; }
.section-name-container .section-name a {
pointer-events: auto; }
.item-container {
padding: 0; }
@@ -225,9 +244,11 @@ pre code {
.item a[name]:before {
content: "";
display: block; }
.item .token {
.item .token, .item .direct-link {
display: inline-block;
text-indent: -20px;
padding-left: 3px;
margin-left: 0px;
margin-left: 20px;
font-size: 1rem; }
.item .declaration-note {
font-size: .85em;
@@ -287,9 +308,9 @@ pre code {
.language .aside-title {
color: #4183c4; }
.aside-warning {
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
@@ -325,6 +346,7 @@ pre code {
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
display: none; }
html.dash .height-container {
display: block; }
@@ -338,14 +360,17 @@ form[role=search] input {
border-radius: 1em; }
.loading form[role=search] input {
background: white url(../img/spinner.gif) center right 4px no-repeat; }
form[role=search] .tt-menu {
margin: 0;
min-width: 300px;
background: #fbfbfb;
color: #333;
border: 1px solid #ddd; }
form[role=search] .tt-highlight {
font-weight: bold; }
form[role=search] .tt-suggestion {
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0 8px; }
@@ -358,11 +383,13 @@ form[role=search] .tt-suggestion {
font-weight: normal;
font-size: 0.9em;
padding-left: 16px; }
form[role=search] .tt-suggestion:hover,
form[role=search] .tt-suggestion.tt-cursor {
cursor: pointer;
background-color: #4183c4;
color: #fff; }
form[role=search] .tt-suggestion:hover .doc-parent-name,
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
color: #fff; }
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enums Reference</title>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enums Reference"></a>
<a title="Enumerations Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Enums Reference
Enumerations Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Enums</h1>
<p>The following enums are available globally.</p>
<div class="section-content top-matter">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</div>
</section>
@@ -110,37 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP5Ports"></a>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP5Ports">Ports</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Common <code><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
<a href="Enums/Ports.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP10AuthMethod"></a>
<a name="/s:9SwiftSMTP10AuthMethodO"></a>
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP10AuthMethod">AuthMethod</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO">AuthMethod</a>
</code>
</div>
<div class="height-container">
@@ -156,23 +132,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP9SMTPError"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO"></a>
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP9SMTPError">SMTPError</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO">SMTPError</a>
</code>
</div>
<div class="height-container">
@@ -188,7 +160,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -203,8 +175,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>AuthMethod Enum Reference</title>
<title>AuthMethod Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a title="AuthMethod Enum Reference"></a>
<a title="AuthMethod Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
AuthMethod Enum Reference
AuthMethod Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>AuthMethod</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_">cramMD5</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_">login</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_">plain</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_">xoauth2</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
</code>
</div>
<div class="height-container">
@@ -227,7 +219,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
</div>
</div>
@@ -242,8 +234,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ports Enum Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a title="Ports Enum Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Ports Enum Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Ports</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
<p>Common <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/tls" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_">tls</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Default <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">tls</span> <span class="o">=</span> <span class="mi">587</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3sslFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/ssl" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3sslFMS0_S0_">ssl</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p><code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> used to connect securely.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">ssl</span> <span class="o">=</span> <span class="mi">465</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTPError Enum Reference</title>
<title>SMTPError Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a title="SMTPError Enum Reference"></a>
<a title="SMTPError Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTPError Enum Reference
SMTPError Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTPError</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_">base64DecodeFail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail(string:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF">base64DecodeFail(string:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_">md5HashChallengeFail</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_"></a>
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_">fileNotFound</a>
<a name="/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/fileNotFound(path:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF">fileNotFound(path:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">fileNotFound</span><span class="p">(</span><span class="nv">path</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">fileNotFound</span><span class="p">(</span><span class="nv">path</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_"></a>
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_">noSupportedAuthMethods</a>
<a name="/s:9SwiftSMTP9SMTPErrorO26noAuthMethodsOrRequiresTLSyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/noAuthMethodsOrRequiresTLS(hostname:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO26noAuthMethodsOrRequiresTLSyACSS_tcACmF">noAuthMethodsOrRequiresTLS(hostname:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -220,63 +212,26 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The preferred <code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s could not be found. Connecting with <code><a href="../Structs/SSL.html">SSL</a></code>
may be required.</p>
<p>The preferred <code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s could not be found, or your server is sending back a STARTTLS command and requires a connection upgrade.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">noSupportedAuthMethods</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">noAuthMethodsOrRequiresTLS</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/noAccessToken" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_">noAccessToken</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Attempted to login using <code>XOAUTH2</code> but <code><a href="../Structs/SMTP.html">SMTP</a></code> instance was initialized
without an access token.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">noAccessToken</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12noRecipientsFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF"></a>
<a name="//apple_ref/swift/Element/noRecipients" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12noRecipientsFMS0_S0_">noRecipients</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF">noRecipients</a>
</code>
</div>
<div class="height-container">
@@ -291,23 +246,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">noRecipients</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">noRecipients</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF"></a>
<a name="//apple_ref/swift/Element/createEmailRegexFailed" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_">createEmailRegexFailed</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF">createEmailRegexFailed</a>
</code>
</div>
<div class="height-container">
@@ -322,23 +273,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_"></a>
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_">badResponse</a>
<a name="/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF"></a>
<a name="//apple_ref/swift/Element/badResponse(command:response:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF">badResponse(command:<wbr>response:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -353,23 +300,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_">convertDataUTF8Fail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail(data:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF">convertDataUTF8Fail(data:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -384,23 +327,19 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_"></a>
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_">invalidEmail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/invalidEmail(email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF">invalidEmail(email:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -408,30 +347,53 @@ without an access token.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Invalid email provided for <code><a href="../Structs/User.html">User</a></code>.</p>
<p>Invalid email provided for <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:vO9SwiftSMTP9SMTPError11descriptionSS"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF"></a>
<a name="//apple_ref/swift/Element/requiredSTARTTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF">requiredSTARTTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>STARTTLS was required but the server did not request it.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requiredSTARTTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:vO9SwiftSMTP9SMTPError11descriptionSS">description</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
@@ -446,7 +408,7 @@ without an access token.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
@@ -461,8 +423,8 @@ without an access token.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structs Reference</title>
<title>Structures Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
<a title="Structs Reference"></a>
<a title="Structures Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Structs Reference
Structures Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Structs</h1>
<p>The following structs are available globally.</p>
<div class="section-content top-matter">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP10Attachment"></a>
<a name="/s:9SwiftSMTP10AttachmentV"></a>
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP10Attachment">Attachment</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV">Attachment</a>
</code>
</div>
<div class="height-container">
@@ -129,23 +133,20 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Attachment</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP4Mail"></a>
<a name="/s:9SwiftSMTP4MailV"></a>
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP4Mail">Mail</a>
<a class="token" href="#/s:9SwiftSMTP4MailV">Mail</a>
</code>
</div>
<div class="height-container">
@@ -161,23 +162,19 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP4SMTP"></a>
<a name="/s:9SwiftSMTP0B0V"></a>
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP4SMTP">SMTP</a>
<a class="token" href="#/s:9SwiftSMTP0B0V">SMTP</a>
</code>
</div>
<div class="height-container">
@@ -185,7 +182,7 @@ Different SMTP servers have different attachment size limits.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
<a href="Structs/SMTP.html" class="slightly-smaller">See more</a>
</div>
@@ -193,23 +190,19 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP3SSL"></a>
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP3SSL">SSL</a>
<a name="/s:9SwiftSMTP16TLSConfigurationV"></a>
<a name="//apple_ref/swift/Struct/TLSConfiguration" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV">TLSConfiguration</a>
</code>
</div>
<div class="height-container">
@@ -217,50 +210,15 @@ Different SMTP servers have different attachment size limits.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Configuration to connect securely through SSL/TLS.
Create an <code>SSL</code> based on your requirements and pass it along to your <code><a href="Structs/SMTP.html">SMTP</a></code>
struct as an initialization parameter.
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></p>
<p>Configuration for connecting with TLS. For more info, see <a href="https://github.com/Kitura/BlueSSLService">https://github.com/Kitura/BlueSSLService</a>.</p>
<a href="Structs/SSL.html" class="slightly-smaller">See more</a>
<a href="Structs/TLSConfiguration.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP4User"></a>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP4User">User</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a sender or receiver of an email.</p>
<a href="Structs/User.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">TLSConfiguration</span></code></pre>
</div>
</div>
@@ -275,8 +233,8 @@ struct as an initialization parameter.
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Attachment Struct Reference</title>
<title>Attachment Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a title="Attachment Struct Reference"></a>
<a title="Attachment Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Attachment Struct Reference
Attachment Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,13 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Attachment</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Attachment</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
</div>
</div>
@@ -118,9 +123,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_"></a>
<a name="/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc"></a>
<a name="//apple_ref/swift/Method/init(data:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_">init(data:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc">init(data:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -135,12 +140,12 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
@@ -206,7 +211,7 @@ Different SMTP servers have different attachment size limits.</p>
</td>
<td>
<div>
<p>Additional headers for the <code>Mail</code>. Header keys
<p>Additional headers for the <code><a href="../Structs/Mail.html">Mail</a></code>. Header keys
are capitalized and duplicate keys will
overwrite each other. Defaults to none. The
following will be ignored: CONTENT-TYPE,
@@ -236,9 +241,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_"></a>
<a name="/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc"></a>
<a name="//apple_ref/swift/Method/init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_">init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc">init(filePath:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -253,12 +258,12 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
@@ -354,9 +359,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_"></a>
<a name="/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc"></a>
<a name="//apple_ref/swift/Method/init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGVs10DictionarySSSS_18relatedAttachmentsGSaS0___S0_">init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc">init(htmlContent:<wbr>characterSet:<wbr>alternative:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -371,11 +376,11 @@ Different SMTP servers have different attachment size limits.</p>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
@@ -454,6 +459,33 @@ Different SMTP servers have different attachment size limits.</p>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns <code>true</code> if the <code>Attachment</code>s are equal.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
@@ -462,8 +494,8 @@ Different SMTP servers have different attachment size limits.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mail Struct Reference</title>
<title>Mail Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
<a title="Mail Struct Reference"></a>
<a title="Mail Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Mail Struct Reference
Mail Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Mail</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
</div>
</div>
@@ -117,9 +121,281 @@
<li class="item">
<div>
<code>
<a name="/s:vV9SwiftSMTP4Mail2idSS"></a>
<a name="/s:9SwiftSMTP4MailV4uuidSSvp"></a>
<a name="//apple_ref/swift/Property/uuid" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSvp">uuid</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A UUID for the mail.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">uuid</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4fromAC4UserVvp"></a>
<a name="//apple_ref/swift/Property/from" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAC4UserVvp">from</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2toSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/to" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAC4UserVGvp">to</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/cc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp">cc</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/bcc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp">bcc</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV7subjectSSvp"></a>
<a name="//apple_ref/swift/Property/subject" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSvp">subject</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4textSSvp"></a>
<a name="//apple_ref/swift/Property/text" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSvp">text</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Text of the <code>Mail</code>. Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">text</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp"></a>
<a name="//apple_ref/swift/Property/attachments" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp">attachments</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are alternatives to plain
text, the last one will be used as the alternative (all the <code>Attachments</code> will still be sent). Defaults to none.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp"></a>
<a name="//apple_ref/swift/Property/alternative" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp">alternative</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Attachment that is an alternative to plain text.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">alternative</span><span class="p">:</span> <span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp"></a>
<a name="//apple_ref/swift/Property/additionalHeaders" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp">additionalHeaders</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Additional headers for the <code>Mail</code>. 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.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">String</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2idSSvp"></a>
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
<a class="token" href="#/s:vV9SwiftSMTP4Mail2idSS">id</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSvp">id</a>
</code>
</div>
<div class="height-container">
@@ -134,7 +410,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">id</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">id</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
@@ -144,9 +420,36 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGVs10DictionarySSSS__S0_"></a>
<a name="/s:9SwiftSMTP4MailV8hostnameSSvp"></a>
<a name="//apple_ref/swift/Property/hostname" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSvp">hostname</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Hostname from the email address.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc"></a>
<a name="//apple_ref/swift/Method/init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGVs10DictionarySSSS__S0_">init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc">init(from:<wbr>to:<wbr>cc:<wbr>bcc:<wbr>subject:<wbr>text:<wbr>attachments:<wbr>additionalHeaders:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -161,14 +464,14 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:])</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:])</span></code></pre>
</div>
</div>
@@ -176,19 +479,6 @@
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>hostname</em>
</code>
</td>
<td>
<div>
<p>Hostname of the SMTP server to connect to. Should not
include any scheme&ndash;ie <code>smtp.example.com</code> is valid.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
@@ -197,7 +487,7 @@
</td>
<td>
<div>
<p>The <code>User</code> that the <code>Mail</code> will be sent from.</p>
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
</div>
</td>
</tr>
@@ -209,7 +499,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to send the <code>Mail</code> to.</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
</div>
</td>
</tr>
@@ -221,7 +511,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to cc. Defaults to none.</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -233,7 +523,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to bcc. Defaults to none.</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -269,11 +559,9 @@
</td>
<td>
<div>
<p>Array of <code>Attachment</code>s for the <code>Mail</code>. If the <code>Mail</code>
has multiple <code>Attachment</code>s that are alternatives to
to plain text, the last one will be used as the
alternative (all the <code>Attachments</code> will still be
sent). Defaults to none.</p>
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are
alternatives to plain text, the last one will be used as the alternative (all the <code>Attachments</code> will still
be sent). Defaults to none.</p>
</div>
</td>
</tr>
@@ -285,11 +573,9 @@
</td>
<td>
<div>
<p>Additional headers for the <code>Mail</code>. 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.</p>
<p>Additional headers for the <code>Mail</code>. 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.</p>
</div>
</td>
</tr>
@@ -299,6 +585,34 @@
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV"></a>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV">User</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a sender or receiver of an email.</p>
<a href="../Structs/Mail/User.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
@@ -307,8 +621,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -0,0 +1,246 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
User Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4nameSSSgvp"></a>
<a name="//apple_ref/swift/Property/name" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4nameSSSgvp">name</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV5emailSSvp"></a>
<a name="//apple_ref/swift/Property/email" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV5emailSSvp">email</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s email address.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc">init(name:<wbr>email:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s email address.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTP Struct Reference</title>
<title>SMTP Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
<a title="SMTP Struct Reference"></a>
<a title="SMTP Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTP Struct Reference
SMTP Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,15 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTP</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
</div>
</div>
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
</div>
</section>
@@ -117,9 +121,37 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSu_S0_"></a>
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSu_S0_">init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)</a>
<a name="/s:9SwiftSMTP0B0V7TLSModeO"></a>
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO">TLSMode</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>TLSMode enum for what form of connection security to enforce.</p>
<a href="../Structs/SMTP/TLSMode.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc"></a>
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:tlsMode:tlsConfiguration:authMethods:domainName:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc">init(hostname:<wbr>email:<wbr>password:<wbr>port:<wbr>tlsMode:<wbr>tlsConfiguration:<wbr>authMethods:<wbr>domainName:<wbr>timeout:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -133,12 +165,9 @@
<p>Note:</p>
<ul>
<li>Some servers like Gmail support IPv6, and if your network does
not, you will first attempt to connect via IPv6, then timeout, and
fall back to IPv4. You can avoid this by disabling IPv6 on your
machine.</li>
<li>You may need to enable access for less secure apps in your account
on the SMTP server.</li>
<li>You may need to enable access for less secure apps for your account on the SMTP server.</li>
<li>Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.</li>
</ul>
</div>
@@ -148,15 +177,15 @@ on the SMTP server.</li>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">port</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span> <span class="o">=</span> <span class="kt"><a href="../Enums/Ports.html">Ports</a></span><span class="o">.</span><span class="n">tls</span><span class="o">.</span><span class="n">rawValue</span><span class="p">,</span>
<span class="nv">ssl</span><span class="p">:</span> <span class="kt"><a href="../Structs/SSL.html">SSL</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
<span class="nv">accessToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">port</span><span class="p">:</span> <span class="kt">Int32</span> <span class="o">=</span> <span class="mi">587</span><span class="p">,</span>
<span class="nv">tlsMode</span><span class="p">:</span> <span class="kt"><a href="../Structs/SMTP/TLSMode.html">TLSMode</a></span> <span class="o">=</span> <span class="o">.</span><span class="n">requireSTARTTLS</span><span class="p">,</span>
<span class="nv">tlsConfiguration</span><span class="p">:</span> <span class="kt"><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -172,15 +201,14 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Hostname of the SMTP server to connect to. Should not
include any scheme&ndash;ie <code>smtp.example.com</code> is valid.</p>
<p>Hostname of the SMTP server to connect to, i.e. <code>smtp.example.com</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>user</em>
<em>email</em>
</code>
</td>
<td>
@@ -197,7 +225,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Password to log in to server.</p>
<p>Password to log in to server, or access token if using XOAUTH2 authorization method.</p>
</div>
</td>
</tr>
@@ -209,24 +237,32 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p><code>Port</code> to connect to the server on. Defaults to <code>587</code>.</p>
<p>Port to connect to the server on. Defaults to <code>465</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>ssl</em>
<em>tlsMode</em>
</code>
</td>
<td>
<div>
<p><code>SSL</code> containing configuration info for connecting securely
through SSL/TLS. If your server has the option to use SSL,
Swift-SMTP will automatically attempt to upgrade the
connection. If you don&rsquo;t provide an SSL configuration,
Swift-SMTP defaults to an SSL configuration with no backing
certificates. See <code>SSL</code> for other configuration options.</p>
<p>TLSMode <code>enum</code> indicating what form of connection security to use.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>tlsConfiguration</em>
</code>
</td>
<td>
<div>
<p><code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> used to connect with TLS. If nil, a configuration with no backing
certificates is used. See <code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> for other configuration options.</p>
</div>
</td>
</tr>
@@ -238,8 +274,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p><code>AuthMethod</code>s to use to log in to the
server. Defaults to <code>CRAM-MD5</code>, <code>LOGIN</code>, and <code>PLAIN</code>.</p>
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. If blank, tries all supported methods.</p>
</div>
</td>
</tr>
@@ -251,21 +286,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Client domain name used when communicating with the
server. Defaults to <code>localhost</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>accessToken</em>
</code>
</td>
<td>
<div>
<p>Access token used if logging in through <code>XOAUTH2</code>.
(optional)</p>
<p>Client domain name used when communicating with the server. Defaults to <code>localhost</code>.</p>
</div>
</td>
</tr>
@@ -277,8 +298,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>How long to try connecting to the server to before
returning an error. Defaults to <code>10</code> seconds.</p>
<p>How long to try connecting to the server to before returning an error. Defaults to <code>10</code> seconds.</p>
</div>
</td>
</tr>
@@ -291,9 +311,9 @@ on the SMTP server.</li>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_"></a>
<a name="/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF"></a>
<a name="//apple_ref/swift/Method/send(_:completion:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_">send(_:completion:)</a>
<a class="token" href="#/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF">send(_:<wbr>completion:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -308,7 +328,7 @@ on the SMTP server.</li>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -324,7 +344,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p><code>Mail</code> object to send.</p>
<p><code><a href="../Structs/Mail.html">Mail</a></code> object to send.</p>
</div>
</td>
</tr>
@@ -336,8 +356,7 @@ on the SMTP server.</li>
</td>
<td>
<div>
<p>Callback when sending finishes. <code>Error</code> is nil on
success. (optional)</p>
<p>Callback when sending finishes. <code>Error</code> is nil on success. (optional)</p>
</div>
</td>
</tr>
@@ -350,9 +369,9 @@ on the SMTP server.</li>
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_"></a>
<a name="/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF"></a>
<a name="//apple_ref/swift/Method/send(_:progress:completion:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_">send(_:progress:completion:)</a>
<a class="token" href="#/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF">send(_:<wbr>progress:<wbr>completion:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -366,15 +385,14 @@ on the SMTP server.</li>
<p>Note:</p>
<ul>
<li>If any of the emails addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code>
are invalid, the entire mail will not send and return an
<code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s,
the whole sending process will not stop until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s
are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one.
To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them in separate calls to
<code>send</code>.</li>
<li>Each call to <code>send</code> will first log in to your server, attempt to send the mails, then closes the
connection. Pass in an array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send them all in one session.</li>
<li>If any of the email addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code> are invalid, the entire mail will not
send and return an <code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s, the whole sending process will continue
until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one. To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them
in separate calls to <code>send</code>.</li>
</ul>
</div>
@@ -384,9 +402,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
<span class="nv">progress</span><span class="p">:</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">completion</span><span class="p">:</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
<span class="nv">progress</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">completion</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -402,7 +420,7 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</td>
<td>
<div>
<p>Array of <code>Mail</code>s to send.</p>
<p>Array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send.</p>
</div>
</td>
</tr>
@@ -414,9 +432,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</td>
<td>
<div>
<p>(<code>Mail</code>, <code>Error</code>) callback after each <code>Mail</code> is sent.
<code>Mail</code> is the <code>Mail</code> sent and <code>Error</code> is the error if it
failed. (optional)</p>
<p>(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="../Structs/Mail.html">Mail</a></code> is sent. <code><a href="../Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is
the error if it failed. (optional)</p>
</div>
</td>
</tr>
@@ -428,11 +445,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</td>
<td>
<div>
<p>([<code>Mail</code>], [(<code>Mail</code>, <code>Error</code>)]) callback after all
<code>Mail</code>s have been attempted. [<code>Mail</code>] is an array of
successfully sent <code>Mail</code>s. [(<code>Mail</code>, <code>Error</code>)] is an
array of failed <code>Mail</code>s and their corresponding
<code>Error</code>s. (optional)</p>
<p>([<code><a href="../Structs/Mail.html">Mail</a></code>], [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="../Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="../Structs/Mail.html">Mail</a></code>] is an
array of successfully sent <code><a href="../Structs/Mail.html">Mail</a></code>s. [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="../Structs/Mail.html">Mail</a></code>s and their
corresponding <code>Error</code>s. (optional)</p>
</div>
</td>
</tr>
@@ -450,8 +465,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -0,0 +1,242 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>TLSMode Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
<a title="TLSMode Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
TLSMode Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>TLSMode</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
</div>
</div>
<p>TLSMode enum for what form of connection security to enforce.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF"></a>
<a name="//apple_ref/swift/Element/normal" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF">normal</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">normal</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/ignoreTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF">ignoreTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ignoreTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF">requireTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>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.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireSTARTTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF">requireSTARTTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>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.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireSTARTTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SSL Struct Reference</title>
<title>TLSConfiguration Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -14,9 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
<a name="//apple_ref/swift/Struct/TLSConfiguration" class="dashAnchor"></a>
<a title="SSL Struct Reference"></a>
<a title="TLSConfiguration Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SSL Struct Reference
TLSConfiguration Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,18 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>SSL</h1>
<div class="section-content top-matter">
<h1>TLSConfiguration</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">TLSConfiguration</span></code></pre>
</div>
</div>
<p>Configuration to connect securely through SSL/TLS.
Create an <code>SSL</code> based on your requirements and pass it along to your <code><a href="../Structs/SMTP.html">SMTP</a></code>
struct as an initialization parameter.
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></p>
<p>Configuration for connecting with TLS. For more info, see <a href="https://github.com/Kitura/BlueSSLService">https://github.com/Kitura/BlueSSLService</a>.</p>
</div>
</section>
@@ -120,9 +121,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT15withCipherSuiteGSqSS_34clientAllowsSelfSignedCertificatesSb_S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc"></a>
<a name="//apple_ref/swift/Method/init(withCipherSuite:clientAllowsSelfSignedCertificates:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT15withCipherSuiteGSqSS_34clientAllowsSelfSignedCertificatesSb_S0_">init(withCipherSuite:clientAllowsSelfSignedCertificates:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc">init(withCipherSuite:<wbr>clientAllowsSelfSignedCertificates:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -137,7 +138,8 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCipherSuite</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCipherSuite</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -178,9 +180,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT25withCACertificateFilePathGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV25withCACertificateFilePath016usingCertificateF00d3KeyF00H15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc"></a>
<a name="//apple_ref/swift/Method/init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT25withCACertificateFilePathGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_">init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV25withCACertificateFilePath016usingCertificateF00d3KeyF00H15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateFilePath:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -195,7 +197,11 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateFilePath</span> <span class="nv">caCertificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateFilePath</span> <span class="nv">caCertificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -272,9 +278,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT26withCACertificateDirectoryGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV26withCACertificateDirectory20usingCertificateFile0d3KeyI00G15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc"></a>
<a name="//apple_ref/swift/Method/init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT26withCACertificateDirectoryGSqSS_20usingCertificateFileGSqSS_11withKeyFileGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_">init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV26withCACertificateDirectory20usingCertificateFile0d3KeyI00G15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateDirectory:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -291,7 +297,11 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateDirectory</span> <span class="nv">caCertificateDirPath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withCACertificateDirectory</span> <span class="nv">caCertificateDirPath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -368,9 +378,9 @@ struct as an initialization parameter.
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb34clientAllowsSelfSignedCertificatesSb11cipherSuiteGSqSS__S0_"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV17withChainFilePath0D8Password20usingSelfSignedCerts012clientAllowsjK12Certificates11cipherSuiteACSSSg_AIS2bAItcfc"></a>
<a name="//apple_ref/swift/Method/init(withChainFilePath:withPassword:usingSelfSignedCerts:clientAllowsSelfSignedCertificates:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb34clientAllowsSelfSignedCertificatesSb11cipherSuiteGSqSS__S0_">init(withChainFilePath:withPassword:usingSelfSignedCerts:clientAllowsSelfSignedCertificates:cipherSuite:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV17withChainFilePath0D8Password20usingSelfSignedCerts012clientAllowsjK12Certificates11cipherSuiteACSSSg_AIS2bAItcfc">init(withChainFilePath:<wbr>withPassword:<wbr>usingSelfSignedCerts:<wbr>clientAllowsSelfSignedCertificates:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -387,7 +397,11 @@ struct as an initialization parameter.
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withChainFilePath</span> <span class="nv">chainFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span> <span class="n">withPassword</span> <span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">withChainFilePath</span> <span class="nv">chainFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
<span class="n">withPassword</span> <span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -431,6 +445,18 @@ struct as an initialization parameter.
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>clientAllowsSelfSignedCertificates</em>
</code>
</td>
<td>
<div>
<p>True if, as a client, connections to self-signed servers are allowed</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
@@ -454,7 +480,7 @@ struct as an initialization parameter.
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Method/init(withPEMCertificateString:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
<a class="token" href="#/">init(withPEMCertificateString:usingSelfSignedCerts:cipherSuite:)</a>
<a class="token" href="#/">init(withPEMCertificateString:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -465,14 +491,6 @@ struct as an initialization parameter.
<p>Initialize a configuration using a <code>PEM formatted certificate in String form</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
</div>
</div>
</section>
</div>
</li>
@@ -484,8 +502,8 @@ struct as an initialization parameter.
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Struct Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Struct Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
User Struct Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_">init(name:email:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>Display name for the user. (optional)</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>Email address for the user.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Typealiases Reference</title>
<title>Type Aliases Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
<a title="Typealiases Reference"></a>
<a title="Type Aliases Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Typealiases Reference
Type Aliases Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Typealiases</h1>
<p>The following typealiases are available globally.</p>
<div class="section-content top-matter">
<h1>Type Aliases</h1>
<p>The following type aliases are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4Port"></a>
<a name="//apple_ref/swift/Alias/Port" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4Port">Port</a>
<a name="/s:9SwiftSMTP8Progressa"></a>
<a name="//apple_ref/swift/Alias/Progress" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP8Progressa">Progress</a>
</code>
</div>
<div class="height-container">
@@ -120,14 +124,42 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Port to connect to SMTP server with.</p>
<p>(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="Structs/Mail.html">Mail</a></code> is sent. <code><a href="Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is the error if it failed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Port</span> <span class="o">=</span> <span class="kt">Int32</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="p">((</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10Completiona"></a>
<a name="//apple_ref/swift/Alias/Completion" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10Completiona">Completion</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>([<code><a href="Structs/Mail.html">Mail</a></code>], [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="Structs/Mail.html">Mail</a></code>] is an array of successfully
sent <code><a href="Structs/Mail.html">Mail</a></code>s. [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="Structs/Mail.html">Mail</a></code>s and their corresponding <code>Error</code>s.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="p">(([</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">],</span> <span class="p">[(</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">)])</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
@@ -142,8 +174,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -63,6 +63,10 @@ a {
a:hover, a:focus {
outline: 0;
text-decoration: underline; }
a.discouraged {
text-decoration: line-through; }
a.discouraged:hover, a.discouraged:focus {
text-decoration: underline line-through; }
table {
background: #fff;
@@ -90,10 +94,10 @@ pre {
code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
p > code, li > code {
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
background: #f7f7f7;
padding: .2em; }
p > code:before, p > code:after, li > code:before, li > code:after {
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
letter-spacing: -.2em;
content: "\00a0"; }
@@ -107,7 +111,6 @@ pre code {
@media (min-width: 768px) {
.content-wrapper {
flex-direction: row; } }
.header {
display: flex;
padding: 8px;
@@ -153,7 +156,6 @@ pre code {
word-wrap: normal;
background: #fbfbfb;
border-right: 1px solid #ddd; } }
.nav-groups {
list-style-type: none;
padding-left: 0; }
@@ -184,7 +186,6 @@ pre code {
order: 2;
flex: 1;
padding-bottom: 60px; } }
.section {
padding: 0 32px;
border-bottom: 1px solid #ddd; }
@@ -197,6 +198,8 @@ pre code {
.section-name {
color: #666;
display: block; }
.section-name p {
margin-bottom: inherit; }
.declaration .highlight {
overflow-x: initial;
@@ -215,6 +218,22 @@ pre code {
content: "";
display: block; }
.section-name-container {
position: relative; }
.section-name-container .section-name-link {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0; }
.section-name-container .section-name {
position: relative;
pointer-events: none;
z-index: 1; }
.section-name-container .section-name a {
pointer-events: auto; }
.item-container {
padding: 0; }
@@ -225,9 +244,11 @@ pre code {
.item a[name]:before {
content: "";
display: block; }
.item .token {
.item .token, .item .direct-link {
display: inline-block;
text-indent: -20px;
padding-left: 3px;
margin-left: 0px;
margin-left: 20px;
font-size: 1rem; }
.item .declaration-note {
font-size: .85em;
@@ -287,9 +308,9 @@ pre code {
.language .aside-title {
color: #4183c4; }
.aside-warning {
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
@@ -325,6 +346,7 @@ pre code {
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
display: none; }
html.dash .height-container {
display: block; }
@@ -338,14 +360,17 @@ form[role=search] input {
border-radius: 1em; }
.loading form[role=search] input {
background: white url(../img/spinner.gif) center right 4px no-repeat; }
form[role=search] .tt-menu {
margin: 0;
min-width: 300px;
background: #fbfbfb;
color: #333;
border: 1px solid #ddd; }
form[role=search] .tt-highlight {
font-weight: bold; }
form[role=search] .tt-suggestion {
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0 8px; }
@@ -358,11 +383,13 @@ form[role=search] .tt-suggestion {
font-weight: normal;
font-size: 0.9em;
padding-left: 16px; }
form[role=search] .tt-suggestion:hover,
form[role=search] .tt-suggestion.tt-cursor {
cursor: pointer;
background-color: #4183c4;
color: #fff; }
form[role=search] .tt-suggestion:hover .doc-parent-name,
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
color: #fff; }
@@ -32,7 +32,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -50,21 +50,18 @@
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +69,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,101 +99,158 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1 id='swift-smtp' class='heading'>Swift-SMTP</h1>
<p><img src="https://github.com/IBM-Swift/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png" alt="Swift-SMTP bird"></p>
<p><img src="https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true" alt="Swift-SMTP bird"></p>
<p>Swift package for sending emails to an SMTP server.</p>
<p>Swift SMTP client.</p>
<p><a href="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master"><img src="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master" alt="Build Status"></a>
<p><img src="https://travis-ci.org/Kitura/Swift-SMTP.svg?branch=master" alt="Build Status">
<img src="https://img.shields.io/badge/os-macOS-green.svg?style=flat" alt="macOS">
<img src="https://img.shields.io/badge/os-linux-green.svg?style=flat" alt="Linux">
<img src="https://img.shields.io/badge/license-Apache2-blue.svg?style=flat" alt="Apache 2"></p>
<h2 id='features' class='heading'>Features</h2>
<ul>
<li>Connect securely through SSL/TLS when available</li>
<li>Connect securely through SSL/TLS when needed</li>
<li>Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2</li>
<li>Send emails with local file, HTML, and raw data attachments</li>
<li>Add custom headers</li>
<li><a href="https://ibm-swift.github.io/Swift-SMTP/">Documentation</a></li>
<li><a href="https://developer.ibm.com/swift/2017/05/31/4675/">Demo &amp; blog post</a></li>
<li><a href="https://kitura.github.io/Swift-SMTP/">Documentation</a></li>
</ul>
<h2 id='swift-version' class='heading'>Swift Version</h2>
<p>macOS &amp; Linux: <code>Swift 3.1.1</code></p>
<p>macOS &amp; Linux: <code>Swift 4.0.3</code>, <code>Swift 4.1</code> and <code>Swift 4.1.2</code></p>
<h2 id='installation' class='heading'>Installation</h2>
<p>You can add <code>SwiftSMTP</code> to your project using <a href="https://swift.org/package-manager/">Swift Package Manager</a>. If your project does not have a <code>Package.swift</code> file, create one by running <code>swift package init</code> in the root directory of your project. Then open <code>Package.swift</code> and add <code>SwiftSMTP</code> as a dependency. Be sure to add it to your desired targets as well:</p>
<pre class="highlight swift"><code><span class="c1">// swift-tools-version:4.0</span>
<span class="kd">import</span> <span class="kt">PackageDescription</span>
<span class="k">let</span> <span class="nv">package</span> <span class="o">=</span> <span class="kt">Package</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
<span class="nv">products</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">library</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
<span class="p">],</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/Kitura/Swift-SMTP"</span><span class="p">,</span> <span class="o">.</span><span class="nf">upToNextMinor</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="s">"5.1.0"</span><span class="p">)),</span> <span class="c1">// add the dependency</span>
<span class="p">],</span>
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">target</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"SwiftSMTP"</span><span class="p">]),</span> <span class="c1">// add targets</span>
<span class="o">.</span><span class="nf">testTarget</span><span class="p">(</span> <span class="c1">// note "SwiftSMTP" (NO HYPHEN)</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProjectTests"</span><span class="p">,</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
<span class="p">]</span>
<span class="p">)</span>
</code></pre>
<p>After adding the dependency and saving, run <code>swift package generate-xcodeproj</code> in the root directory of your project. This will fetch dependencies and create an Xcode project which you can open and begin editing.</p>
<h2 id='migration-guide' class='heading'>Migration Guide</h2>
<p>Version <code>5.0.0</code> brings breaking changes. See the quick migration guide <a href="https://github.com/Kitura/Swift-SMTP/blob/master/migration-guide.md">here</a>.</p>
<h2 id='usage' class='heading'>Usage</h2>
<p>Use the <code>SMTP</code> struct as a handle to your SMTP server:</p>
<p>Initialize an <code><a href="Structs/SMTP.html">SMTP</a></code> instance:</p>
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">SwiftSMTP</span>
<span class="c1">// Create your `SMTP` handle</span>
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
<span class="nv">user</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login </span>
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span><span class="p">)</span> <span class="c1">// password to login</span>
<span class="cm">/* Additional parameters available to further customize your `SMTP` handle */</span>
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span>
<span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
<span class="nv">email</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login</span>
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span> <span class="c1">// password to login</span>
<span class="p">)</span>
</code></pre>
<h3 id='ssl' class='heading'>SSL</h3>
<h3 id='tls' class='heading'>TLS</h3>
<p>If required, <code>Swift-SMTP</code> automatically upgrades your connection to an SSL connection. By default, this uses no backing certificates. View docs on the <a href="https://ibm-swift.github.io/Swift-SMTP/Structs/SSL.html">SSL</a> struct to see how to customize this.</p>
<p>Additional parameters of <code><a href="Structs/SMTP.html">SMTP</a></code> struct:</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">port</span><span class="p">:</span> <span class="kt">Int32</span> <span class="o">=</span> <span class="mi">587</span><span class="p">,</span>
<span class="nv">tlsMode</span><span class="p">:</span> <span class="kt">TLSMode</span> <span class="o">=</span> <span class="o">.</span><span class="n">requireSTARTTLS</span><span class="p">,</span>
<span class="nv">tlsConfiguration</span><span class="p">:</span> <span class="kt">TLSConfiguration</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt">AuthMethod</span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span>
</code></pre>
<p>By default, the <code><a href="Structs/SMTP.html">SMTP</a></code> struct connects on port <code>587</code> and sends mail only if a TLS connection can be established. It also uses a <code><a href="Structs/TLSConfiguration.html">TLSConfiguration</a></code> that uses no backing certificates. View the <a href="https://kitura.github.io/Swift-SMTP/">docs</a> for more configuration options.</p>
<h3 id='send-email' class='heading'>Send email</h3>
<p>Create a <code>Mail</code> object and use your <code>smtp</code> handle to send it. To set the sender and receiver of an email, use the <code>User</code> struct:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">drLight</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Dr. Light"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"drlight@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">megaman</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Megaman"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"megaman@gmail.com"</span><span class="p">)</span>
<p>Create a <code><a href="Structs/Mail.html">Mail</a></code> object and use your <code><a href="Structs/SMTP.html">SMTP</a></code> handle to send it. To set the sender and receiver of an email, use the <code>User</code> struct:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">drLight</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Dr. Light"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"drlight@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">megaman</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Megaman"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"megaman@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Humans and robots living together in harmony and equality."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"That was my ultimate wish."</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Humans and robots living together in harmony and equality."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"That was my ultimate wish."</span>
<span class="p">)</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">err</span><span class="p">)</span> <span class="k">in</span>
<span class="k">if</span> <span class="k">let</span> <span class="nv">err</span> <span class="o">=</span> <span class="n">err</span> <span class="p">{</span>
<span class="nf">print</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="k">if</span> <span class="k">let</span> <span class="nv">error</span> <span class="o">=</span> <span class="n">error</span> <span class="p">{</span>
<span class="nf">print</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>Add Cc and Bcc:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span>
<span class="p">)</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
</code></pre>
<h3 id='send-attachments' class='heading'>Send attachments</h3>
<p>Create an <code>Attachment</code>, attach it to your <code>Mail</code>, and send it through the <code>smtp</code> handle. Here&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<p>Create an <code><a href="Structs/Attachment.html">Attachment</a></code>, attach it to your <code><a href="Structs/Mail.html">Mail</a></code>, and send it through the <code><a href="Structs/SMTP.html">SMTP</a></code> handle. Here&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<pre class="highlight swift"><code><span class="c1">// Create a file `Attachment`</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// You can add "CONTENT-ID" to reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// "CONTENT-ID" lets you reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create an HTML `Attachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">])</span> <span class="c1">// to reference `fileAttachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="c1">// To reference `fileAttachment`</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create a data `Attachment`</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="s">"{</span><span class="se">\"</span><span class="s">key</span><span class="se">\"</span><span class="s">: </span><span class="se">\"</span><span class="s">hello world</span><span class="se">\"</span><span class="s">}"</span><span class="o">.</span><span class="nf">data</span><span class="p">(</span><span class="nv">using</span><span class="p">:</span> <span class="o">.</span><span class="n">utf8</span><span class="p">)</span><span class="o">!</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span><span class="p">)</span> <span class="c1">// send as a standalone attachment</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="c1">// send as a standalone attachment</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">)</span>
<span class="c1">// Create a `Mail` and include the `Attachment`s</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">])</span> <span class="c1">// attachments we created earlier</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="c1">// The attachments we created earlier</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Send the mail</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
@@ -201,7 +261,7 @@
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mail1</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
<span class="k">let</span> <span class="nv">mail2</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">([</span><span class="n">mail1</span><span class="p">,</span> <span class="n">mail2</span><span class="p">],</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">([</span><span class="n">mail1</span><span class="p">,</span> <span class="n">mail2</span><span class="p">],</span>
<span class="c1">// This optional callback gets called after each `Mail` is sent.</span>
<span class="c1">// `mail` is the attempted `Mail`, `error` is the error if one occured.</span>
<span class="nv">progress</span><span class="p">:</span> <span class="p">{</span> <span class="p">(</span><span class="n">mail</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
@@ -216,10 +276,10 @@
</code></pre>
<h2 id='acknowledgements' class='heading'>Acknowledgements</h2>
<p><code>Swift-SMTP</code> was inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>, two Swift packages that can also be used to send emails to an SMTP server.</p>
<p>Inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>.</p>
<h2 id='license' class='heading'>License</h2>
<p>Apache 2.0</p>
<p>Apache v2.0</p>
</div>
</section>
@@ -228,8 +288,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -8,26 +8,41 @@ if (navigator.userAgent.match(/xcode/i)) {
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
@@ -36,8 +51,20 @@ $(".token").click(function(event) {
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
// KaTeX rendering
if ("katex" in window) {
$($('.math').each( (_, element) => {
katex.render(element.textContent, element, {
displayMode: $(element).hasClass('m-block'),
throwOnError: false,
trust: true
});
}))
}
@@ -1,9 +1,4 @@
$(function(){
var searchIndex = lunr(function() {
this.ref('url');
this.field('name');
});
var $typeahead = $('[data-typeahead]');
var $form = $typeahead.parents('form');
var searchURL = $form.attr('action');
@@ -26,21 +21,34 @@ $(function(){
$form.addClass('loading');
$.getJSON(searchURL).then(function(searchData) {
$.each(searchData, function (url, doc) {
searchIndex.add({url: url, name: doc.name});
const searchIndex = lunr(function() {
this.ref('url');
this.field('name');
this.field('abstract');
for (const [url, doc] of Object.entries(searchData)) {
this.add({url: url, name: doc.name, abstract: doc.abstract});
}
});
$typeahead.typeahead(
{
highlight: true,
minLength: 3
minLength: 3,
autoselect: true
},
{
limit: 10,
display: displayTemplate,
templates: { suggestion: suggestionTemplate },
source: function(query, sync) {
var results = searchIndex.search(query).map(function(result) {
const lcSearch = query.toLowerCase();
const results = searchIndex.query(function(q) {
q.term(lcSearch, { boost: 100 });
q.term(lcSearch, {
boost: 10,
wildcard: lunr.Query.wildcard.TRAILING
});
}).map(function(result) {
var doc = searchData[result.ref];
doc.url = result.ref;
return doc;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,18 +1,19 @@
/*!
* typeahead.js 0.11.1
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* typeahead.js 1.3.1
* https://github.com/corejavascript/typeahead.js
* Copyright 2013-2020 Twitter, Inc. and other contributors; Licensed MIT
*/
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("typeahead.js", [ "jquery" ], function(a0) {
define([ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
@@ -148,6 +149,13 @@
stringify: function(val) {
return _.isString(val) ? val : JSON.stringify(val);
},
guid: function() {
function _p8(s) {
var p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return "tt-" + _p8() + _p8(true) + _p8(true) + _p8();
},
noop: function() {}
};
}();
@@ -189,7 +197,7 @@
function buildHtml(c) {
return {
wrapper: '<span class="' + c.wrapper + '"></span>',
menu: '<div class="' + c.menu + '"></div>'
menu: '<div role="listbox" class="' + c.menu + '"></div>'
};
}
function buildSelectors(classes) {
@@ -264,10 +272,8 @@
}
_.mixin(EventBus.prototype, {
_trigger: function(type, args) {
var $e;
$e = $.Event(namespace + type);
(args = args || []).unshift($e);
this.$el.trigger.apply(this.$el, args);
var $e = $.Event(namespace + type);
this.$el.trigger.call(this.$el, $e, args || []);
return $e;
},
before: function(type) {
@@ -384,7 +390,36 @@
tagName: "strong",
className: null,
wordsOnly: false,
caseSensitive: false
caseSensitive: false,
diacriticInsensitive: false
};
var accented = {
A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]",
B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]",
C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]",
D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]",
E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]",
F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]",
G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]",
H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]",
I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]",
J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]",
K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]",
L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]",
M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]",
N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]",
O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]",
P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]",
Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]",
R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]",
S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]",
T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]",
U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]",
V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]",
W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]",
X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]",
Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]",
Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]"
};
return function hightlight(o) {
var regex;
@@ -393,7 +428,7 @@
return;
}
o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive);
traverse(o.node, hightlightTextNode);
function hightlightTextNode(textNode) {
var match, patternNode, wrapperNode;
@@ -419,10 +454,17 @@
}
}
};
function getRegex(patterns, caseSensitive, wordsOnly) {
function accent_replacer(chr) {
return accented[chr.toUpperCase()] || chr;
}
function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) {
var escapedPatterns = [], regexStr;
for (var i = 0, len = patterns.length; i < len; i++) {
escapedPatterns.push(_.escapeRegExChars(patterns[i]));
var escapedWord = _.escapeRegExChars(patterns[i]);
if (diacriticInsensitive) {
escapedWord = escapedWord.replace(/\S/g, accent_replacer);
}
escapedPatterns.push(escapedWord);
}
regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
@@ -441,6 +483,7 @@
40: "down"
};
function Input(o, www) {
var id;
o = o || {};
if (!o.input) {
$.error("input is missing");
@@ -448,6 +491,18 @@
www.mixin(this);
this.$hint = $(o.hint);
this.$input = $(o.input);
this.$menu = $(o.menu);
id = this.$input.attr("id") || _.guid();
this.$menu.attr("id", id + "_listbox");
this.$hint.attr({
"aria-hidden": true
});
this.$input.attr({
"aria-owns": id + "_listbox",
role: "combobox",
"aria-autocomplete": "list",
"aria-expanded": false
});
this.query = this.$input.val();
this.queryWhenFocused = this.hasFocus() ? this.query : null;
this.$overflowHelper = buildOverflowHelper(this.$input);
@@ -455,6 +510,7 @@
if (this.$hint.length === 0) {
this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
}
this.onSync("cursorchange", this._updateDescendent);
}
Input.normalizeQuery = function(str) {
return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
@@ -524,6 +580,9 @@
this.trigger("whitespaceChanged", this.query);
}
},
_updateDescendent: function updateDescendent(event, id) {
this.$input.attr("aria-activedescendant", id);
},
bind: function() {
var that = this, onBlur, onFocus, onKeydown, onInput;
onBlur = _.bind(this._onBlur, this);
@@ -616,6 +675,9 @@
this.$input.off(".tt");
this.$overflowHelper.remove();
this.$hint = this.$input = this.$overflowHelper = $("<div>");
},
setAriaExpanded: function setAriaExpanded(value) {
this.$input.attr("aria-expanded", value);
}
});
return Input;
@@ -647,6 +709,7 @@
"use strict";
var keys, nameGenerator;
keys = {
dataset: "tt-selectable-dataset",
val: "tt-selectable-display",
obj: "tt-selectable-object"
};
@@ -666,19 +729,20 @@
}
www.mixin(this);
this.highlight = !!o.highlight;
this.name = o.name || nameGenerator();
this.name = _.toStr(o.name || nameGenerator());
this.limit = o.limit || 5;
this.displayFn = getDisplayFn(o.display || o.displayKey);
this.templates = getTemplates(o.templates, this.displayFn);
this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source;
this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async;
this._resetLastSuggestion();
this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
}
Dataset.extractData = function extractData(el) {
var $el = $(el);
if ($el.data(keys.obj)) {
return {
dataset: $el.data(keys.dataset) || "",
val: $el.data(keys.val) || "",
obj: $el.data(keys.obj) || null
};
@@ -697,7 +761,7 @@
} else {
this._empty();
}
this.trigger("rendered", this.name, suggestions, false);
this.trigger("rendered", suggestions, false, this.name);
},
_append: function append(query, suggestions) {
suggestions = suggestions || [];
@@ -708,7 +772,7 @@
} else if (!this.$lastSuggestion.length && this.templates.notFound) {
this._renderNotFound(query);
}
this.trigger("rendered", this.name, suggestions, true);
this.trigger("rendered", suggestions, true, this.name);
},
_renderSuggestions: function renderSuggestions(query, suggestions) {
var $fragment;
@@ -749,7 +813,7 @@
_.each(suggestions, function getSuggestionNode(suggestion) {
var $el, context;
context = that._injectQuery(query, suggestion);
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
$el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
fragment.appendChild($el[0]);
});
this.highlight && highlight({
@@ -787,7 +851,7 @@
this.cancel = function cancel() {
canceled = true;
that.cancel = $.noop;
that.async && that.trigger("asyncCanceled", query);
that.async && that.trigger("asyncCanceled", query, that.name);
};
this.source(query, sync, async);
!syncCalled && sync([]);
@@ -800,16 +864,17 @@
rendered = suggestions.length;
that._overwrite(query, suggestions);
if (rendered < that.limit && that.async) {
that.trigger("asyncRequested", query);
that.trigger("asyncRequested", query, that.name);
}
}
function async(suggestions) {
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
that.async && that.trigger("asyncReceived", query);
var idx = Math.abs(rendered - that.limit);
rendered += idx;
that._append(query, suggestions.slice(0, idx));
that.async && that.trigger("asyncReceived", query, that.name);
}
}
},
@@ -840,10 +905,14 @@
pending: templates.pending && _.templatify(templates.pending),
header: templates.header && _.templatify(templates.header),
footer: templates.footer && _.templatify(templates.footer),
suggestion: templates.suggestion || suggestionTemplate
suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate
};
function userSuggestionTemplate(context) {
var template = templates.suggestion;
return $(template(context)).attr("id", _.guid());
}
function suggestionTemplate(context) {
return $("<div>").text(displayFn(context));
return $('<div role="option">').attr("id", _.guid()).text(displayFn(context));
}
}
function isValidName(str) {
@@ -884,10 +953,11 @@
this.trigger.apply(this, arguments);
},
_allDatasetsEmpty: function allDatasetsEmpty() {
return _.every(this.datasets, isDatasetEmpty);
function isDatasetEmpty(dataset) {
return dataset.isEmpty();
}
return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) {
var isEmpty = dataset.isEmpty();
this.$node.attr("aria-expanded", !isEmpty);
return isEmpty;
}, this));
},
_getSelectables: function getSelectables() {
return this.$node.find(this.selectors.selectable);
@@ -912,6 +982,12 @@
var that = this, onSelectableClick;
onSelectableClick = _.bind(this._onSelectableClick, this);
this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
this.$node.on("mouseover", this.selectors.selectable, function() {
that.setCursor($(this));
});
this.$node.on("mouseleave", function() {
that._removeCursor();
});
_.each(this.datasets, function(dataset) {
dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that);
});
@@ -921,9 +997,11 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
this.$node.attr("aria-expanded", false);
this.$node.removeClass(this.classes.open);
this._removeCursor();
},
@@ -988,6 +1066,55 @@
});
return Menu;
}();
var Status = function() {
"use strict";
function Status(options) {
this.$el = $("<span></span>", {
role: "status",
"aria-live": "polite"
}).css({
position: "absolute",
padding: "0",
border: "0",
height: "1px",
width: "1px",
"margin-bottom": "-1px",
"margin-right": "-1px",
overflow: "hidden",
clip: "rect(0 0 0 0)",
"white-space": "nowrap"
});
options.$input.after(this.$el);
_.each(options.menu.datasets, _.bind(function(dataset) {
if (dataset.onSync) {
dataset.onSync("rendered", _.bind(this.update, this));
dataset.onSync("cleared", _.bind(this.cleared, this));
}
}, this));
}
_.mixin(Status.prototype, {
update: function update(event, suggestions) {
var length = suggestions.length;
var words;
if (length === 1) {
words = {
result: "result",
is: "is"
};
} else {
words = {
result: "results",
is: "are"
};
}
this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate.");
},
cleared: function() {
this.$el.text("");
}
});
return Status;
}();
var DefaultMenu = function() {
"use strict";
var s = Menu.prototype;
@@ -1052,6 +1179,7 @@
this.input = o.input;
this.menu = o.menu;
this.enabled = true;
this.autoselect = !!o.autoselect;
this.active = false;
this.input.hasFocus() && this.activate();
this.dir = this.input.getLangDir();
@@ -1098,8 +1226,12 @@
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
_onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) {
this._updateHint();
if (this.autoselect) {
var cursorClass = this.selectors.cursor.substr(1);
this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass);
}
this.eventBus.trigger("render", suggestions, async, dataset);
},
_onAsyncRequested: function onAsyncRequested(type, dataset, query) {
@@ -1122,15 +1254,25 @@
_onEnterKeyed: function onEnterKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
if (this.select($selectable)) {
$e.preventDefault();
$e.stopPropagation();
}
} else if (this.autoselect) {
if (this.select(this.menu.getTopSelectable())) {
$e.preventDefault();
$e.stopPropagation();
}
}
},
_onTabKeyed: function onTabKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
} else if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
} else if (this.autoselect) {
if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
}
}
},
_onEscKeyed: function onEscKeyed() {
@@ -1144,12 +1286,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
@@ -1226,6 +1368,7 @@
},
open: function open() {
if (!this.isOpen() && !this.eventBus.before("open")) {
this.input.setAriaExpanded(true);
this.menu.open();
this._updateHint();
this.eventBus.trigger("open");
@@ -1234,6 +1377,7 @@
},
close: function close() {
if (this.isOpen() && !this.eventBus.before("close")) {
this.input.setAriaExpanded(false);
this.menu.close();
this.input.clearHint();
this.input.resetInputValue();
@@ -1249,9 +1393,9 @@
},
select: function select($selectable) {
var data = this.menu.getSelectableData($selectable);
if (data && !this.eventBus.before("select", data.obj)) {
if (data && !this.eventBus.before("select", data.obj, data.dataset)) {
this.input.setQuery(data.val, true);
this.eventBus.trigger("select", data.obj);
this.eventBus.trigger("select", data.obj, data.dataset);
this.close();
return true;
}
@@ -1262,29 +1406,34 @@
query = this.input.getQuery();
data = this.menu.getSelectableData($selectable);
isValid = data && query !== data.val;
if (isValid && !this.eventBus.before("autocomplete", data.obj)) {
if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) {
this.input.setQuery(data.val);
this.eventBus.trigger("autocomplete", data.obj);
this.eventBus.trigger("autocomplete", data.obj, data.dataset);
return true;
}
return false;
},
moveCursor: function moveCursor(delta) {
var query, $candidate, data, payload, cancelMove;
var query, $candidate, data, suggestion, datasetName, cancelMove, id;
query = this.input.getQuery();
$candidate = this.menu.selectableRelativeToCursor(delta);
data = this.menu.getSelectableData($candidate);
payload = data ? data.obj : null;
suggestion = data ? data.obj : null;
datasetName = data ? data.dataset : null;
id = $candidate ? $candidate.attr("id") : null;
this.input.trigger("cursorchange", id);
cancelMove = this._minLengthMet() && this.menu.update(query);
if (!cancelMove && !this.eventBus.before("cursorchange", payload)) {
if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) {
this.menu.setCursor($candidate);
if (data) {
this.input.setInputValue(data.val);
if (typeof data.val === "string") {
this.input.setInputValue(data.val);
}
} else {
this.input.resetInputValue();
this._updateHint();
}
this.eventBus.trigger("cursorchange", payload);
this.eventBus.trigger("cursorchange", suggestion, datasetName);
return true;
}
return false;
@@ -1322,7 +1471,7 @@
www = WWW(o.classNames);
return this.each(attach);
function attach() {
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor;
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor;
_.each(datasets, function(d) {
d.highlight = !!o.highlight;
});
@@ -1347,17 +1496,23 @@
});
input = new Input({
hint: $hint,
input: $input
input: $input,
menu: $menu
}, www);
menu = new MenuConstructor({
node: $menu,
datasets: datasets
}, www);
status = new Status({
$input: $input,
menu: menu
});
typeahead = new Typeahead({
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength
minLength: o.minLength,
autoselect: o.autoselect
}, www);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
@@ -1450,7 +1605,7 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal));
});
return this;
}
@@ -1481,8 +1636,10 @@
});
}
function buildHintFromInput($input, www) {
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({
autocomplete: "off",
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({
readonly: true,
required: false
}).removeAttr("id name placeholder").removeClass("required").attr({
spellcheck: "false",
tabindex: -1
});
@@ -1495,7 +1652,6 @@
style: $input.attr("style")
});
$input.addClass(www.classes.input).attr({
autocomplete: "off",
spellcheck: false
});
try {
File diff suppressed because one or more lines are too long
Binary file not shown.
+124 -64
View File
@@ -32,7 +32,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -50,21 +50,18 @@
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +69,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,101 +99,158 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1 id='swift-smtp' class='heading'>Swift-SMTP</h1>
<p><img src="https://github.com/IBM-Swift/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png" alt="Swift-SMTP bird"></p>
<p><img src="https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true" alt="Swift-SMTP bird"></p>
<p>Swift package for sending emails to an SMTP server.</p>
<p>Swift SMTP client.</p>
<p><a href="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master"><img src="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master" alt="Build Status"></a>
<p><img src="https://travis-ci.org/Kitura/Swift-SMTP.svg?branch=master" alt="Build Status">
<img src="https://img.shields.io/badge/os-macOS-green.svg?style=flat" alt="macOS">
<img src="https://img.shields.io/badge/os-linux-green.svg?style=flat" alt="Linux">
<img src="https://img.shields.io/badge/license-Apache2-blue.svg?style=flat" alt="Apache 2"></p>
<h2 id='features' class='heading'>Features</h2>
<ul>
<li>Connect securely through SSL/TLS when available</li>
<li>Connect securely through SSL/TLS when needed</li>
<li>Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2</li>
<li>Send emails with local file, HTML, and raw data attachments</li>
<li>Add custom headers</li>
<li><a href="https://ibm-swift.github.io/Swift-SMTP/">Documentation</a></li>
<li><a href="https://developer.ibm.com/swift/2017/05/31/4675/">Demo &amp; blog post</a></li>
<li><a href="https://kitura.github.io/Swift-SMTP/">Documentation</a></li>
</ul>
<h2 id='swift-version' class='heading'>Swift Version</h2>
<p>macOS &amp; Linux: <code>Swift 3.1.1</code></p>
<p>macOS &amp; Linux: <code>Swift 4.0.3</code>, <code>Swift 4.1</code> and <code>Swift 4.1.2</code></p>
<h2 id='installation' class='heading'>Installation</h2>
<p>You can add <code>SwiftSMTP</code> to your project using <a href="https://swift.org/package-manager/">Swift Package Manager</a>. If your project does not have a <code>Package.swift</code> file, create one by running <code>swift package init</code> in the root directory of your project. Then open <code>Package.swift</code> and add <code>SwiftSMTP</code> as a dependency. Be sure to add it to your desired targets as well:</p>
<pre class="highlight swift"><code><span class="c1">// swift-tools-version:4.0</span>
<span class="kd">import</span> <span class="kt">PackageDescription</span>
<span class="k">let</span> <span class="nv">package</span> <span class="o">=</span> <span class="kt">Package</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
<span class="nv">products</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">library</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
<span class="p">],</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/Kitura/Swift-SMTP"</span><span class="p">,</span> <span class="o">.</span><span class="nf">upToNextMinor</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="s">"5.1.0"</span><span class="p">)),</span> <span class="c1">// add the dependency</span>
<span class="p">],</span>
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span>
<span class="o">.</span><span class="nf">target</span><span class="p">(</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"SwiftSMTP"</span><span class="p">]),</span> <span class="c1">// add targets</span>
<span class="o">.</span><span class="nf">testTarget</span><span class="p">(</span> <span class="c1">// note "SwiftSMTP" (NO HYPHEN)</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProjectTests"</span><span class="p">,</span>
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
<span class="p">]</span>
<span class="p">)</span>
</code></pre>
<p>After adding the dependency and saving, run <code>swift package generate-xcodeproj</code> in the root directory of your project. This will fetch dependencies and create an Xcode project which you can open and begin editing.</p>
<h2 id='migration-guide' class='heading'>Migration Guide</h2>
<p>Version <code>5.0.0</code> brings breaking changes. See the quick migration guide <a href="https://github.com/Kitura/Swift-SMTP/blob/master/migration-guide.md">here</a>.</p>
<h2 id='usage' class='heading'>Usage</h2>
<p>Use the <code>SMTP</code> struct as a handle to your SMTP server:</p>
<p>Initialize an <code><a href="Structs/SMTP.html">SMTP</a></code> instance:</p>
<pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">SwiftSMTP</span>
<span class="c1">// Create your `SMTP` handle</span>
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
<span class="nv">user</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login </span>
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span><span class="p">)</span> <span class="c1">// password to login</span>
<span class="cm">/* Additional parameters available to further customize your `SMTP` handle */</span>
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span>
<span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
<span class="nv">email</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login</span>
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span> <span class="c1">// password to login</span>
<span class="p">)</span>
</code></pre>
<h3 id='ssl' class='heading'>SSL</h3>
<h3 id='tls' class='heading'>TLS</h3>
<p>If required, <code>Swift-SMTP</code> automatically upgrades your connection to an SSL connection. By default, this uses no backing certificates. View docs on the <a href="https://ibm-swift.github.io/Swift-SMTP/Structs/SSL.html">SSL</a> struct to see how to customize this.</p>
<p>Additional parameters of <code><a href="Structs/SMTP.html">SMTP</a></code> struct:</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="nv">port</span><span class="p">:</span> <span class="kt">Int32</span> <span class="o">=</span> <span class="mi">587</span><span class="p">,</span>
<span class="nv">tlsMode</span><span class="p">:</span> <span class="kt">TLSMode</span> <span class="o">=</span> <span class="o">.</span><span class="n">requireSTARTTLS</span><span class="p">,</span>
<span class="nv">tlsConfiguration</span><span class="p">:</span> <span class="kt">TLSConfiguration</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt">AuthMethod</span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span>
</code></pre>
<p>By default, the <code><a href="Structs/SMTP.html">SMTP</a></code> struct connects on port <code>587</code> and sends mail only if a TLS connection can be established. It also uses a <code><a href="Structs/TLSConfiguration.html">TLSConfiguration</a></code> that uses no backing certificates. View the <a href="https://kitura.github.io/Swift-SMTP/">docs</a> for more configuration options.</p>
<h3 id='send-email' class='heading'>Send email</h3>
<p>Create a <code>Mail</code> object and use your <code>smtp</code> handle to send it. To set the sender and receiver of an email, use the <code>User</code> struct:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">drLight</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Dr. Light"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"drlight@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">megaman</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Megaman"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"megaman@gmail.com"</span><span class="p">)</span>
<p>Create a <code><a href="Structs/Mail.html">Mail</a></code> object and use your <code><a href="Structs/SMTP.html">SMTP</a></code> handle to send it. To set the sender and receiver of an email, use the <code>User</code> struct:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">drLight</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Dr. Light"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"drlight@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">megaman</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Megaman"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"megaman@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Humans and robots living together in harmony and equality."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"That was my ultimate wish."</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Humans and robots living together in harmony and equality."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"That was my ultimate wish."</span>
<span class="p">)</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">err</span><span class="p">)</span> <span class="k">in</span>
<span class="k">if</span> <span class="k">let</span> <span class="nv">err</span> <span class="o">=</span> <span class="n">err</span> <span class="p">{</span>
<span class="nf">print</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">error</span><span class="p">)</span> <span class="k">in</span>
<span class="k">if</span> <span class="k">let</span> <span class="nv">error</span> <span class="o">=</span> <span class="n">error</span> <span class="p">{</span>
<span class="nf">print</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>Add Cc and Bcc:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span>
<span class="p">)</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
</code></pre>
<h3 id='send-attachments' class='heading'>Send attachments</h3>
<p>Create an <code>Attachment</code>, attach it to your <code>Mail</code>, and send it through the <code>smtp</code> handle. Here&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<p>Create an <code><a href="Structs/Attachment.html">Attachment</a></code>, attach it to your <code><a href="Structs/Mail.html">Mail</a></code>, and send it through the <code><a href="Structs/SMTP.html">SMTP</a></code> handle. Here&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<pre class="highlight swift"><code><span class="c1">// Create a file `Attachment`</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// You can add "CONTENT-ID" to reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// "CONTENT-ID" lets you reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create an HTML `Attachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">])</span> <span class="c1">// to reference `fileAttachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="c1">// To reference `fileAttachment`</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create a data `Attachment`</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="s">"{</span><span class="se">\"</span><span class="s">key</span><span class="se">\"</span><span class="s">: </span><span class="se">\"</span><span class="s">hello world</span><span class="se">\"</span><span class="s">}"</span><span class="o">.</span><span class="nf">data</span><span class="p">(</span><span class="nv">using</span><span class="p">:</span> <span class="o">.</span><span class="n">utf8</span><span class="p">)</span><span class="o">!</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span><span class="p">)</span> <span class="c1">// send as a standalone attachment</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="c1">// send as a standalone attachment</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">)</span>
<span class="c1">// Create a `Mail` and include the `Attachment`s</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">])</span> <span class="c1">// attachments we created earlier</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="c1">// The attachments we created earlier</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Send the mail</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
@@ -201,7 +261,7 @@
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mail1</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
<span class="k">let</span> <span class="nv">mail2</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">([</span><span class="n">mail1</span><span class="p">,</span> <span class="n">mail2</span><span class="p">],</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">([</span><span class="n">mail1</span><span class="p">,</span> <span class="n">mail2</span><span class="p">],</span>
<span class="c1">// This optional callback gets called after each `Mail` is sent.</span>
<span class="c1">// `mail` is the attempted `Mail`, `error` is the error if one occured.</span>
<span class="nv">progress</span><span class="p">:</span> <span class="p">{</span> <span class="p">(</span><span class="n">mail</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
@@ -216,10 +276,10 @@
</code></pre>
<h2 id='acknowledgements' class='heading'>Acknowledgements</h2>
<p><code>Swift-SMTP</code> was inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>, two Swift packages that can also be used to send emails to an SMTP server.</p>
<p>Inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>.</p>
<h2 id='license' class='heading'>License</h2>
<p>Apache 2.0</p>
<p>Apache v2.0</p>
</div>
</section>
@@ -228,8 +288,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-08-29)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+45 -18
View File
@@ -8,26 +8,41 @@ if (navigator.userAgent.match(/xcode/i)) {
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
@@ -36,8 +51,20 @@ $(".token").click(function(event) {
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
// KaTeX rendering
if ("katex" in window) {
$($('.math').each( (_, element) => {
katex.render(element.textContent, element, {
displayMode: $(element).hasClass('m-block'),
throwOnError: false,
trust: true
});
}))
}
+17 -9
View File
@@ -1,9 +1,4 @@
$(function(){
var searchIndex = lunr(function() {
this.ref('url');
this.field('name');
});
var $typeahead = $('[data-typeahead]');
var $form = $typeahead.parents('form');
var searchURL = $form.attr('action');
@@ -26,21 +21,34 @@ $(function(){
$form.addClass('loading');
$.getJSON(searchURL).then(function(searchData) {
$.each(searchData, function (url, doc) {
searchIndex.add({url: url, name: doc.name});
const searchIndex = lunr(function() {
this.ref('url');
this.field('name');
this.field('abstract');
for (const [url, doc] of Object.entries(searchData)) {
this.add({url: url, name: doc.name, abstract: doc.abstract});
}
});
$typeahead.typeahead(
{
highlight: true,
minLength: 3
minLength: 3,
autoselect: true
},
{
limit: 10,
display: displayTemplate,
templates: { suggestion: suggestionTemplate },
source: function(query, sync) {
var results = searchIndex.search(query).map(function(result) {
const lcSearch = query.toLowerCase();
const results = searchIndex.query(function(q) {
q.term(lcSearch, { boost: 100 });
q.term(lcSearch, {
boost: 10,
wildcard: lunr.Query.wildcard.TRAILING
});
}).map(function(result) {
var doc = searchData[result.ref];
doc.url = result.ref;
return doc;
Vendored Executable → Regular
+2 -4
View File
File diff suppressed because one or more lines are too long
Vendored Executable → Regular
+3 -3
View File
File diff suppressed because one or more lines are too long
+209 -53
View File
@@ -1,18 +1,19 @@
/*!
* typeahead.js 0.11.1
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* typeahead.js 1.3.1
* https://github.com/corejavascript/typeahead.js
* Copyright 2013-2020 Twitter, Inc. and other contributors; Licensed MIT
*/
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("typeahead.js", [ "jquery" ], function(a0) {
define([ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
@@ -148,6 +149,13 @@
stringify: function(val) {
return _.isString(val) ? val : JSON.stringify(val);
},
guid: function() {
function _p8(s) {
var p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return "tt-" + _p8() + _p8(true) + _p8(true) + _p8();
},
noop: function() {}
};
}();
@@ -189,7 +197,7 @@
function buildHtml(c) {
return {
wrapper: '<span class="' + c.wrapper + '"></span>',
menu: '<div class="' + c.menu + '"></div>'
menu: '<div role="listbox" class="' + c.menu + '"></div>'
};
}
function buildSelectors(classes) {
@@ -264,10 +272,8 @@
}
_.mixin(EventBus.prototype, {
_trigger: function(type, args) {
var $e;
$e = $.Event(namespace + type);
(args = args || []).unshift($e);
this.$el.trigger.apply(this.$el, args);
var $e = $.Event(namespace + type);
this.$el.trigger.call(this.$el, $e, args || []);
return $e;
},
before: function(type) {
@@ -384,7 +390,36 @@
tagName: "strong",
className: null,
wordsOnly: false,
caseSensitive: false
caseSensitive: false,
diacriticInsensitive: false
};
var accented = {
A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]",
B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]",
C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]",
D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]",
E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]",
F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]",
G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]",
H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]",
I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]",
J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]",
K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]",
L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]",
M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]",
N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]",
O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]",
P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]",
Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]",
R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]",
S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]",
T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]",
U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]",
V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]",
W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]",
X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]",
Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]",
Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]"
};
return function hightlight(o) {
var regex;
@@ -393,7 +428,7 @@
return;
}
o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive);
traverse(o.node, hightlightTextNode);
function hightlightTextNode(textNode) {
var match, patternNode, wrapperNode;
@@ -419,10 +454,17 @@
}
}
};
function getRegex(patterns, caseSensitive, wordsOnly) {
function accent_replacer(chr) {
return accented[chr.toUpperCase()] || chr;
}
function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) {
var escapedPatterns = [], regexStr;
for (var i = 0, len = patterns.length; i < len; i++) {
escapedPatterns.push(_.escapeRegExChars(patterns[i]));
var escapedWord = _.escapeRegExChars(patterns[i]);
if (diacriticInsensitive) {
escapedWord = escapedWord.replace(/\S/g, accent_replacer);
}
escapedPatterns.push(escapedWord);
}
regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
@@ -441,6 +483,7 @@
40: "down"
};
function Input(o, www) {
var id;
o = o || {};
if (!o.input) {
$.error("input is missing");
@@ -448,6 +491,18 @@
www.mixin(this);
this.$hint = $(o.hint);
this.$input = $(o.input);
this.$menu = $(o.menu);
id = this.$input.attr("id") || _.guid();
this.$menu.attr("id", id + "_listbox");
this.$hint.attr({
"aria-hidden": true
});
this.$input.attr({
"aria-owns": id + "_listbox",
role: "combobox",
"aria-autocomplete": "list",
"aria-expanded": false
});
this.query = this.$input.val();
this.queryWhenFocused = this.hasFocus() ? this.query : null;
this.$overflowHelper = buildOverflowHelper(this.$input);
@@ -455,6 +510,7 @@
if (this.$hint.length === 0) {
this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
}
this.onSync("cursorchange", this._updateDescendent);
}
Input.normalizeQuery = function(str) {
return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
@@ -524,6 +580,9 @@
this.trigger("whitespaceChanged", this.query);
}
},
_updateDescendent: function updateDescendent(event, id) {
this.$input.attr("aria-activedescendant", id);
},
bind: function() {
var that = this, onBlur, onFocus, onKeydown, onInput;
onBlur = _.bind(this._onBlur, this);
@@ -616,6 +675,9 @@
this.$input.off(".tt");
this.$overflowHelper.remove();
this.$hint = this.$input = this.$overflowHelper = $("<div>");
},
setAriaExpanded: function setAriaExpanded(value) {
this.$input.attr("aria-expanded", value);
}
});
return Input;
@@ -647,6 +709,7 @@
"use strict";
var keys, nameGenerator;
keys = {
dataset: "tt-selectable-dataset",
val: "tt-selectable-display",
obj: "tt-selectable-object"
};
@@ -666,19 +729,20 @@
}
www.mixin(this);
this.highlight = !!o.highlight;
this.name = o.name || nameGenerator();
this.name = _.toStr(o.name || nameGenerator());
this.limit = o.limit || 5;
this.displayFn = getDisplayFn(o.display || o.displayKey);
this.templates = getTemplates(o.templates, this.displayFn);
this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source;
this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async;
this._resetLastSuggestion();
this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
}
Dataset.extractData = function extractData(el) {
var $el = $(el);
if ($el.data(keys.obj)) {
return {
dataset: $el.data(keys.dataset) || "",
val: $el.data(keys.val) || "",
obj: $el.data(keys.obj) || null
};
@@ -697,7 +761,7 @@
} else {
this._empty();
}
this.trigger("rendered", this.name, suggestions, false);
this.trigger("rendered", suggestions, false, this.name);
},
_append: function append(query, suggestions) {
suggestions = suggestions || [];
@@ -708,7 +772,7 @@
} else if (!this.$lastSuggestion.length && this.templates.notFound) {
this._renderNotFound(query);
}
this.trigger("rendered", this.name, suggestions, true);
this.trigger("rendered", suggestions, true, this.name);
},
_renderSuggestions: function renderSuggestions(query, suggestions) {
var $fragment;
@@ -749,7 +813,7 @@
_.each(suggestions, function getSuggestionNode(suggestion) {
var $el, context;
context = that._injectQuery(query, suggestion);
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
$el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
fragment.appendChild($el[0]);
});
this.highlight && highlight({
@@ -787,7 +851,7 @@
this.cancel = function cancel() {
canceled = true;
that.cancel = $.noop;
that.async && that.trigger("asyncCanceled", query);
that.async && that.trigger("asyncCanceled", query, that.name);
};
this.source(query, sync, async);
!syncCalled && sync([]);
@@ -800,16 +864,17 @@
rendered = suggestions.length;
that._overwrite(query, suggestions);
if (rendered < that.limit && that.async) {
that.trigger("asyncRequested", query);
that.trigger("asyncRequested", query, that.name);
}
}
function async(suggestions) {
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
that.async && that.trigger("asyncReceived", query);
var idx = Math.abs(rendered - that.limit);
rendered += idx;
that._append(query, suggestions.slice(0, idx));
that.async && that.trigger("asyncReceived", query, that.name);
}
}
},
@@ -840,10 +905,14 @@
pending: templates.pending && _.templatify(templates.pending),
header: templates.header && _.templatify(templates.header),
footer: templates.footer && _.templatify(templates.footer),
suggestion: templates.suggestion || suggestionTemplate
suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate
};
function userSuggestionTemplate(context) {
var template = templates.suggestion;
return $(template(context)).attr("id", _.guid());
}
function suggestionTemplate(context) {
return $("<div>").text(displayFn(context));
return $('<div role="option">').attr("id", _.guid()).text(displayFn(context));
}
}
function isValidName(str) {
@@ -884,10 +953,11 @@
this.trigger.apply(this, arguments);
},
_allDatasetsEmpty: function allDatasetsEmpty() {
return _.every(this.datasets, isDatasetEmpty);
function isDatasetEmpty(dataset) {
return dataset.isEmpty();
}
return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) {
var isEmpty = dataset.isEmpty();
this.$node.attr("aria-expanded", !isEmpty);
return isEmpty;
}, this));
},
_getSelectables: function getSelectables() {
return this.$node.find(this.selectors.selectable);
@@ -912,6 +982,12 @@
var that = this, onSelectableClick;
onSelectableClick = _.bind(this._onSelectableClick, this);
this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
this.$node.on("mouseover", this.selectors.selectable, function() {
that.setCursor($(this));
});
this.$node.on("mouseleave", function() {
that._removeCursor();
});
_.each(this.datasets, function(dataset) {
dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that);
});
@@ -921,9 +997,11 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
this.$node.attr("aria-expanded", false);
this.$node.removeClass(this.classes.open);
this._removeCursor();
},
@@ -988,6 +1066,55 @@
});
return Menu;
}();
var Status = function() {
"use strict";
function Status(options) {
this.$el = $("<span></span>", {
role: "status",
"aria-live": "polite"
}).css({
position: "absolute",
padding: "0",
border: "0",
height: "1px",
width: "1px",
"margin-bottom": "-1px",
"margin-right": "-1px",
overflow: "hidden",
clip: "rect(0 0 0 0)",
"white-space": "nowrap"
});
options.$input.after(this.$el);
_.each(options.menu.datasets, _.bind(function(dataset) {
if (dataset.onSync) {
dataset.onSync("rendered", _.bind(this.update, this));
dataset.onSync("cleared", _.bind(this.cleared, this));
}
}, this));
}
_.mixin(Status.prototype, {
update: function update(event, suggestions) {
var length = suggestions.length;
var words;
if (length === 1) {
words = {
result: "result",
is: "is"
};
} else {
words = {
result: "results",
is: "are"
};
}
this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate.");
},
cleared: function() {
this.$el.text("");
}
});
return Status;
}();
var DefaultMenu = function() {
"use strict";
var s = Menu.prototype;
@@ -1052,6 +1179,7 @@
this.input = o.input;
this.menu = o.menu;
this.enabled = true;
this.autoselect = !!o.autoselect;
this.active = false;
this.input.hasFocus() && this.activate();
this.dir = this.input.getLangDir();
@@ -1098,8 +1226,12 @@
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
_onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) {
this._updateHint();
if (this.autoselect) {
var cursorClass = this.selectors.cursor.substr(1);
this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass);
}
this.eventBus.trigger("render", suggestions, async, dataset);
},
_onAsyncRequested: function onAsyncRequested(type, dataset, query) {
@@ -1122,15 +1254,25 @@
_onEnterKeyed: function onEnterKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
if (this.select($selectable)) {
$e.preventDefault();
$e.stopPropagation();
}
} else if (this.autoselect) {
if (this.select(this.menu.getTopSelectable())) {
$e.preventDefault();
$e.stopPropagation();
}
}
},
_onTabKeyed: function onTabKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
} else if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
} else if (this.autoselect) {
if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
}
}
},
_onEscKeyed: function onEscKeyed() {
@@ -1144,12 +1286,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
@@ -1226,6 +1368,7 @@
},
open: function open() {
if (!this.isOpen() && !this.eventBus.before("open")) {
this.input.setAriaExpanded(true);
this.menu.open();
this._updateHint();
this.eventBus.trigger("open");
@@ -1234,6 +1377,7 @@
},
close: function close() {
if (this.isOpen() && !this.eventBus.before("close")) {
this.input.setAriaExpanded(false);
this.menu.close();
this.input.clearHint();
this.input.resetInputValue();
@@ -1249,9 +1393,9 @@
},
select: function select($selectable) {
var data = this.menu.getSelectableData($selectable);
if (data && !this.eventBus.before("select", data.obj)) {
if (data && !this.eventBus.before("select", data.obj, data.dataset)) {
this.input.setQuery(data.val, true);
this.eventBus.trigger("select", data.obj);
this.eventBus.trigger("select", data.obj, data.dataset);
this.close();
return true;
}
@@ -1262,29 +1406,34 @@
query = this.input.getQuery();
data = this.menu.getSelectableData($selectable);
isValid = data && query !== data.val;
if (isValid && !this.eventBus.before("autocomplete", data.obj)) {
if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) {
this.input.setQuery(data.val);
this.eventBus.trigger("autocomplete", data.obj);
this.eventBus.trigger("autocomplete", data.obj, data.dataset);
return true;
}
return false;
},
moveCursor: function moveCursor(delta) {
var query, $candidate, data, payload, cancelMove;
var query, $candidate, data, suggestion, datasetName, cancelMove, id;
query = this.input.getQuery();
$candidate = this.menu.selectableRelativeToCursor(delta);
data = this.menu.getSelectableData($candidate);
payload = data ? data.obj : null;
suggestion = data ? data.obj : null;
datasetName = data ? data.dataset : null;
id = $candidate ? $candidate.attr("id") : null;
this.input.trigger("cursorchange", id);
cancelMove = this._minLengthMet() && this.menu.update(query);
if (!cancelMove && !this.eventBus.before("cursorchange", payload)) {
if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) {
this.menu.setCursor($candidate);
if (data) {
this.input.setInputValue(data.val);
if (typeof data.val === "string") {
this.input.setInputValue(data.val);
}
} else {
this.input.resetInputValue();
this._updateHint();
}
this.eventBus.trigger("cursorchange", payload);
this.eventBus.trigger("cursorchange", suggestion, datasetName);
return true;
}
return false;
@@ -1322,7 +1471,7 @@
www = WWW(o.classNames);
return this.each(attach);
function attach() {
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor;
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor;
_.each(datasets, function(d) {
d.highlight = !!o.highlight;
});
@@ -1347,17 +1496,23 @@
});
input = new Input({
hint: $hint,
input: $input
input: $input,
menu: $menu
}, www);
menu = new MenuConstructor({
node: $menu,
datasets: datasets
}, www);
status = new Status({
$input: $input,
menu: menu
});
typeahead = new Typeahead({
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength
minLength: o.minLength,
autoselect: o.autoselect
}, www);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
@@ -1450,7 +1605,7 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal));
});
return this;
}
@@ -1481,8 +1636,10 @@
});
}
function buildHintFromInput($input, www) {
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({
autocomplete: "off",
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({
readonly: true,
required: false
}).removeAttr("id name placeholder").removeClass("required").attr({
spellcheck: "false",
tabindex: -1
});
@@ -1495,7 +1652,6 @@
style: $input.attr("style")
});
$input.addClass(www.classes.input).attr({
autocomplete: "off",
spellcheck: false
});
try {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2,5 +2,5 @@
"warnings": [
],
"source_directory": "/Users/quanvo/IBM/Swift-SMTP"
"source_directory": "/Users/dannys/projects/kitura/Swift-SMTP"
}
+90
View File
@@ -0,0 +1,90 @@
# 5.0.0 Migration Guide
- The default port is now `587`.
- The `SMTP` struct is now initialized with a `TLSMode` enum instead of a `useTLS` Bool, allowing more configuration options:
```swift
/// 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
- `User` struct now nested in `Mail` struct to avoid namespace issues [(69)](https://github.com/Kitura/Swift-SMTP/pull/69). Create a user like so:
```swift
let sender = Mail.User(name: "Sloth", email: "sloth@gmail.com")
```
- `User` properties are now public
- The optional `accessToken` parameter of the `SMTP` struct has been removed. If you are using the authorization method `XOAUTH2`, pass in your access token in the `password` parameter instead. For example:
```swift
let smtp = SMTP(
hostname: "smtp.gmail.com",
email: "example@gmail.com",
password: "accessToken",
authMethods: [.xoauth2]
)
```
- Fixed a bug where the wrong `Attachment` was used an an alternative to text content when a `Mail` was initialized with multiple `Attachment`s [(67)](https://github.com/Kitura/Swift-SMTP/pull/67)
# 3.0.0 Migration Guide
## Initialize `SMTP`
Before `3.0.0`:
```swift
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`:
```swift
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
- `SSL` renamed to `TLSConfiguration`
## Removed
- `Port` typealias
## Other Changes
- `Mail` properties are now public