45 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
72 changed files with 4106 additions and 2216 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 @@
4.0.3
5.1
+27 -3
View File
@@ -1,19 +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: focal
sudo: required
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: xcode9.1
osx_image: xcode12.2
sudo: required
env: JAZZY_ELIGIBLE=true
- os: osx
osx_image: xcode13.2
sudo: required
env: USE_SWIFT_DEVELOPMENT_SNAPSHOT=1
before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
- git clone https://github.com/Kitura/Package-Builder.git
script:
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
+6 -12
View File
@@ -1,27 +1,21 @@
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "SwiftSMTP",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SwiftSMTP",
targets: ["SwiftSMTP"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/IBM-Swift/BlueSocket.git", .upToNextMinor(from: "0.12.0")),
.package(url: "https://github.com/IBM-Swift/BlueSSLService.git", .upToNextMinor(from: "0.12.0")),
.package(url: "https://github.com/IBM-Swift/BlueCryptor.git", .upToNextMinor(from: "0.8.0")),
.package(url: "https://github.com/IBM-Swift/LoggerAPI.git", .upToNextMinor(from: "1.7.0")),
],
.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: [
// Targets are the basic building blocks of a package. A target defines a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SwiftSMTP",
dependencies: ["Socket", "SSLService", "Cryptor", "LoggerAPI"]),
+97 -51
View File
@@ -1,10 +1,10 @@
# Swift-SMTP
![Swift-SMTP bird](https://github.com/IBM-Swift/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true)
![Swift-SMTP bird](https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true)
Swift SMTP client.
![Build Status](https://travis-ci.org/IBM-Swift/Swift-SMTP.svg?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)
@@ -15,61 +15,94 @@ Swift SMTP client.
- Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2
- Send emails with local file, HTML, and raw data attachments
- Add custom headers
- [Fully documented](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 4.0.3`
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 3.0.0 brings breaking changes. See the quick migration guide [here](https://github.com/IBM-Swift/Swift-SMTP/blob/master/migration-guide.md).
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
email: "user@gmail.com", // username to login
password: "password") // password to login
let smtp = SMTP(
hostname: "smtp.gmail.com", // SMTP server address
email: "user@gmail.com", // username to login
password: "password" // password to login
)
```
### TLS
All parameters of `SMTP` struct:
Additional parameters of `SMTP` struct:
```swift
let smtp = SMTP(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)
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 `465` and tries to connect using TLS. It also uses a `TLSConfiguration` that uses no backing certificates. Configure these to your needs. For more info on `TLSConfiguration`, view the [docs](https://ibm-swift.github.io/Swift-SMTP/Structs/TLSConfiguration.html).
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:
```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) { (error) in
if let error = error {
@@ -81,15 +114,17 @@ smtp.send(mail) { (error) 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)
```
@@ -100,26 +135,37 @@ Create an `Attachment`, attach it to your `Mail`, and send it through the `SMTP`
```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)
@@ -149,7 +195,7 @@ smtp.send([mail1, mail2],
## Acknowledgements
`Swift-SMTP` was inspired by two other Swift SMTP clients, [Hedwig](https://github.com/onevcat/Hedwig) and [Perfect-SMTP](https://github.com/PerfectlySoft/Perfect-SMTP).
Inspired by [Hedwig](https://github.com/onevcat/Hedwig) and [Perfect-SMTP](https://github.com/PerfectlySoft/Perfect-SMTP).
## License
+50 -14
View File
@@ -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
}
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ struct AuthEncoder {
extension String {
func base64Decoded() throws -> String {
guard let data = Data(base64Encoded: self),
guard let data = Data(base64Encoded: self, options: .ignoreUnknownCharacters),
let base64Decoded = String(data: data, encoding: .utf8) else {
throw SMTPError.base64DecodeFail(string: self)
}
+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"
}
+4 -4
View File
@@ -44,8 +44,8 @@ enum Command {
}
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"
@@ -63,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]
+8 -6
View File
@@ -21,9 +21,17 @@ enum Result<T, Error> {
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
@@ -35,9 +43,3 @@ extension String {
return "=?UTF-8?Q?\(quoted)?="
}
}
extension String {
var base64Encoded: String {
return Data(utf8).base64EncodedString()
}
}
+21 -22
View File
@@ -15,6 +15,7 @@
**/
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.
@@ -22,10 +23,7 @@ import Foundation
// 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) {
@@ -33,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 {
@@ -56,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,7 +68,7 @@ extension DataSender {
// 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)
@@ -90,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)
@@ -99,7 +97,7 @@ extension DataSender {
}
// Send the `attachment`.
mutating func sendAttachment(_ attachment: Attachment) throws {
func sendAttachment(_ attachment: Attachment) throws {
var relatedBoundary = ""
if attachment.hasRelated {
@@ -113,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)
@@ -139,7 +136,7 @@ extension DataSender {
}
#endif
let encodedData = data.base64EncodedData()
let encodedData = data.base64EncodedData(options: .lineLength76Characters)
try send(encodedData)
#if os(macOS)
@@ -151,7 +148,7 @@ extension DataSender {
// 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)
@@ -166,7 +163,7 @@ extension DataSender {
throw SMTPError.fileNotFound(path: path)
}
let data = file.readDataToEndOfFile().base64EncodedData()
let data = file.readDataToEndOfFile().base64EncodedData(options: .lineLength76Characters)
try send(data)
file.closeFile()
@@ -179,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)
@@ -190,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
}
}
@@ -204,17 +201,19 @@ 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 endered 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/plain; charset=utf-8\(CRLF)"
-181
View File
@@ -1,181 +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
protocol LoginManaging {
func login(completion: (Result<SMTPSocket, Error>) -> Void)
}
class LoginManager: LoginManaging {
private let hostname: String
private let email: String
private let password: String
private let port: Int32
private let useTLS: Bool
private let tlsConfiguration: TLSConfiguration?
private let authMethods: [AuthMethod]
private let accessToken: String?
private let domainName: String
private let timeout: UInt
private var socket: SMTPSocket!
init(hostname: String,
email: String,
password: String,
port: Int32,
useTLS: Bool,
tlsConfiguration: TLSConfiguration?,
authMethods: [AuthMethod],
accessToken: String?,
domainName: String,
timeout: UInt) {
self.hostname = hostname
self.email = email
self.password = password
self.port = port
self.useTLS = useTLS
self.tlsConfiguration = tlsConfiguration
self.authMethods = authMethods
self.accessToken = accessToken
self.domainName = domainName
self.timeout = timeout * 1000
}
func login(completion: (Result<SMTPSocket, Error>) -> Void) {
do {
socket = try SMTPSocket()
if useTLS {
if let tlsConfiguration = tlsConfiguration {
socket.setDelegate(try tlsConfiguration.makeSSLService())
} else {
socket.setDelegate(try TLSConfiguration().makeSSLService())
}
}
try connect(port)
try login(getServerInfo())
completion(.success(socket))
} catch {
completion(.failure(error))
}
}
}
private extension LoginManager {
func connect(_ port: Int32) throws {
try socket.connect(to: hostname, port: port, timeout: timeout)
try SMTPSocket.parseResponses(try socket.readFromSocket(), command: .connect)
}
func getServerInfo() throws -> [Response] {
do {
return try ehlo()
} catch {
return try helo()
}
}
func login(_ serverInfo: [Response]) throws {
switch try getAuthMethod(serverInfo) {
case .cramMD5:
try loginCramMD5()
case .login:
try loginLogin()
case .plain:
try loginPlain()
case .xoauth2:
try loginXOAuth2()
}
}
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 LoginManager {
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 LoginManager {
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 responses = try socket.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 socket.send(.authUser(user))
}
func authPassword(_ password: String) throws {
try socket.send(.authPassword(password))
}
}
+55 -13
View File
@@ -20,23 +20,32 @@ import Foundation
public struct Mail {
/// 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]
@@ -49,7 +58,11 @@ public struct Mail {
/// Hostname from the email address.
public var hostname: String {
let fullEmail = from.email
#if swift(>=4.2)
let atIndex = fullEmail.firstIndex(of: "@")
#else
let atIndex = fullEmail.index(of: "@")
#endif
let hostStart = fullEmail.index(after: atIndex!)
return String(fullEmail[hostStart...])
}
@@ -64,11 +77,11 @@ public struct Mail {
/// - 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 plain text, the last one will be used as the alternative (all the
/// `Attachments` will still be sent). Defaults to none.
/// 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.
/// 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] = [],
@@ -92,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
@@ -133,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
}
}
}
}
+12 -17
View File
@@ -20,7 +20,11 @@ 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 MailSender {
@@ -81,9 +85,7 @@ private extension MailSender {
try socket.send(.quit)
socket.close()
}
}
private extension MailSender {
func send(_ mail: Mail) throws {
let recipientEmails = try getRecipientEmails(from: mail)
try validateEmails(recipientEmails)
@@ -94,7 +96,7 @@ private extension MailSender {
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 }
@@ -106,43 +108,36 @@ private extension MailSender {
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)
}
}
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
+78 -61
View File
@@ -16,72 +16,81 @@
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"
}
/// Represents a handle to connect, authenticate, and send emails to an SMTP server.
/// Used to connect to an SMTP server and send emails.
public struct SMTP {
private let loginManager: LoginManaging
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.
/// Should not include any scheme--ie `smtp.example.com` is valid.
/// - 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.
/// - 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`.
/// - useTLS: `Bool` indicating whether to connect with TLS. Your server must support the `STARTTLS` command.
/// Defaults to `true`.
/// - 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. Defaults to `CRAM-MD5`, `LOGIN`, and `PLAIN`.
/// - accessToken: Access token used IFF logging in through `XOAUTH2`.
/// 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.
/// - 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: Int32 = 465,
useTLS: Bool = true,
port: Int32 = 587,
tlsMode: TLSMode = .requireSTARTTLS,
tlsConfiguration: TLSConfiguration? = nil,
authMethods: [AuthMethod] = [],
accessToken: String? = nil,
domainName: String = "localhost",
timeout: UInt = 10) {
loginManager = LoginManager(
hostname: hostname,
email: email,
password: password,
port: port,
useTLS: useTLS,
tlsConfiguration: tlsConfiguration,
authMethods: !authMethods.isEmpty ? authMethods : [
AuthMethod.cramMD5,
AuthMethod.login,
AuthMethod.plain
],
accessToken: accessToken,
domainName: domainName,
timeout: timeout)
}
self.hostname = hostname
self.email = email
self.password = password
self.port = port
self.tlsMode = tlsMode
self.tlsConfiguration = tlsConfiguration
init(loginManager: LoginManaging) {
self.loginManager = loginManager
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.
@@ -90,24 +99,24 @@ public struct SMTP {
/// - 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
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)
/// - 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)
/// 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
@@ -125,17 +134,25 @@ public struct SMTP {
completion?([], [])
return
}
loginManager.login { result in
switch result {
case .failure(let error):
completion?([], mails.map { ($0, error) })
case .success(let socket):
MailSender(
socket: socket,
mailsToSend: mails,
progress: progress,
completion: completion).send()
}
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) })
}
}
}
+8 -10
View File
@@ -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,16 +60,16 @@ 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(description)
+171 -78
View File
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corporation 2017
* 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.
@@ -18,65 +18,62 @@ import Foundation
import Socket
import LoggerAPI
// Wrapper around BlueSocket
struct SMTPSocket {
// The socket we use to read and write to
private let socket: Socket
// Init a new instance of SMTPSocket
init() throws {
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)
}
// Connect to the SMTP server at `port`
func connect(to: String, port: Int32, 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)")
}
@discardableResult
func send(_ command: Command) throws -> [Response] {
try write(command.text)
return try parseResponses(readFromSocket(), command: command)
}
func close() {
socket.close()
}
}
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
private extension SMTPSocket {
func readFromSocket() throws -> String {
var buf = Data()
_ = try socket.read(into: &buf)
@@ -87,42 +84,44 @@ extension SMTPSocket {
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 {
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)
}
var validResponses = [Response]()
for res in resArr {
if res == "" { break }
validResponses.append(Response(code: try getResponseCode(res, command: command),
message: getResponseMessage(res),
response: res))
#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
)
}
return validResponses
#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
}
// 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 {
func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
guard response.count > 3 else {
throw SMTPError.badResponse(command: command.text, response: response)
}
#if swift(>=3.2)
guard let code = Int(response[..<response.index(response.startIndex, offsetBy: 3)]) else {
throw SMTPError.badResponse(command: command.text, response: response)
}
#else
guard let code = Int(response.substring(to: response.index(response.startIndex, offsetBy: 3))) else {
throw SMTPError.badResponse(command: command.text, response: response)
}
#endif
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 {
@@ -131,16 +130,110 @@ extension SMTPSocket {
return ResponseCode(code)
}
// Returns the reponse message from the response
static func getResponseMessage(_ response: String) -> String {
func getResponseMessage(_ response: String) -> String {
guard response.count > 3 else {
return ""
}
#if swift(>=3.2)
return String(response[response.index(response.startIndex, offsetBy: 4)...])
#else
return response.substring(from: response.index(response.startIndex, offsetBy: 4))
#endif
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))
}
}
+1 -1
View File
@@ -17,7 +17,7 @@
import Foundation
import SSLService
/// Configuration for connecting with TLS. For more info, see https://github.com/IBM-Swift/BlueSSLService.
/// Configuration for connecting with TLS. For more info, see https://github.com/Kitura/BlueSSLService.
public struct TLSConfiguration {
private let configuration: SSLService.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 {
private 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
}
}
}
+12 -29
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 {
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)
self.swapAt(firstUnshuffled, 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 where Indices.Iterator.Element == Index {
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])
}
}
}
#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(TestLoginManager.allTests.shuffled()),
testCase(TestMailSender.allTests.shuffled()),
testCase(TestMiscellaneous.allTests.shuffled()),
testCase(TestSMTPSocket.allTests.shuffled())
].shuffled())
testCase(TestSMTPSocket.allTests.shuffled()),
testCase(TestTLSMode.allTests.shuffled())].shuffled())
+55 -10
View File
@@ -25,13 +25,16 @@ let testDuration: Double = 15
// 📧📧📧 Fill in your own SMTP login info for local testing
// DO NOT CHECK IN YOUR EMAIL CREDENTALS!!!
let hostname = "smtp.gmail.com"
let hostname = "mail.kitura.dev"
let myEmail: String? = nil
let myPassword: String? = nil
let port: Int32 = 465
let useTLS = true
let authMethods: [AuthMethod] = [.cramMD5, .login, .plain]
let accessToken: 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
@@ -56,12 +59,21 @@ let password: String = {
}()
let senderEmailDomain: String = {
if let atIndex = email.index(of: "@") {
let domainStart = email.index(after: atIndex)
#if swift(>=5)
if let atIndex = email.firstIndex(of: "@") {
let domainStart = email.index(after: atIndex)
return String(email[domainStart...])
} else {
return "gmail.com"
}
#else
if let atIndex = email.index(of: "@") {
let domainStart = email.index(after: atIndex)
return String(email[domainStart...])
} else {
return "gmail.com"
}
#endif
}()
let testsDir: String = {
@@ -79,9 +91,9 @@ let tlsConfiguration = TLSConfiguration(withChainFilePath: cert, withPassword: c
#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 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"
@@ -93,8 +105,41 @@ 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)
}
}
-184
View File
@@ -1,184 +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 TestLoginManager: 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) }
LoginManager(
hostname: hostname,
email: email,
password: "bad password",
port: port,
useTLS: useTLS,
tlsConfiguration: nil,
authMethods: authMethods,
accessToken: accessToken,
domainName: domainName,
timeout: timeout).login { result in
switch result {
case .failure(let error):
if case SMTPError.badResponse = error {
x.fulfill()
} else {
XCTFail()
x.fulfill()
}
case .success:
XCTFail()
x.fulfill()
}
}
}
func testBadPort() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
LoginManager(
hostname: hostname,
email: email,
password: password,
port: 1,
useTLS: useTLS,
tlsConfiguration: nil,
authMethods: authMethods,
accessToken: accessToken,
domainName: domainName,
timeout: 5).login { result in
switch result {
case .failure:
x.fulfill()
case .success:
XCTFail()
x.fulfill()
}
}
}
func testLogin() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
LoginManager(
hostname: hostname,
email: email,
password: password,
port: port,
useTLS: useTLS,
tlsConfiguration: nil,
authMethods: [.login],
accessToken: accessToken,
domainName: domainName,
timeout: timeout).login { result in
switch result {
case .failure:
XCTFail()
x.fulfill()
case .success:
x.fulfill()
}
}
}
func testPlain() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
LoginManager(
hostname: hostname,
email: email,
password: password,
port: port,
useTLS: useTLS,
tlsConfiguration: nil,
authMethods: [.plain],
accessToken: accessToken,
domainName: domainName,
timeout: timeout).login { result in
switch result {
case .failure:
XCTFail()
x.fulfill()
case .success:
x.fulfill()
}
}
}
func testPort0() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
LoginManager(
hostname: hostname,
email: email,
password: password,
port: 0,
useTLS: useTLS,
tlsConfiguration: nil,
authMethods: [.plain],
accessToken: accessToken,
domainName: domainName,
timeout: 5).login { result in
switch result {
case .failure:
x.fulfill()
case .success:
XCTFail()
x.fulfill()
}
}
}
func testSSL() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
LoginManager(
hostname: hostname,
email: email,
password: password,
port: port,
useTLS: useTLS,
tlsConfiguration: tlsConfiguration,
authMethods: authMethods,
accessToken: accessToken,
domainName: domainName,
timeout: timeout).login { result in
switch result {
case .failure:
XCTFail()
x.fulfill()
case .success:
x.fulfill()
}
}
}
}
+19 -31
View File
@@ -24,12 +24,11 @@ import XCTest
class TestMailSender: XCTestCase {
static var allTests = [
("testBadEmail", testBadEmail),
("testIsValidEmail", testIsValidEmail),
("testSendMail", testSendMail),
("testSendMailInArray", testSendMailInArray),
("testSendMailNoRecipient", testSendMailNoRecipient),
("testSendMailToMultipleRecipients", testSendMailToMultipleRecipients),
("testSendMailsConcurrently", testSendMailsConcurrently),
("testSendMailToMultipleRecipients", testSendMailToMultipleRecipients),
("testSendMailWithBcc", testSendMailWithBcc),
("testSendMailWithCc", testSendMailWithCc),
("testSendMultipleMails", testSendMultipleMails),
@@ -39,7 +38,7 @@ class TestMailSender: XCTestCase {
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 TestMailSender: 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 TestMailSender: 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() {
@@ -95,16 +83,6 @@ class TestMailSender: XCTestCase {
}
}
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()
}
waitForExpectations(timeout: testDuration)
}
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")
@@ -123,6 +101,16 @@ class TestMailSender: XCTestCase {
waitForExpectations(timeout: testDuration)
}
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()
}
waitForExpectations(timeout: testDuration)
}
func testSendMailWithBcc() {
let x = expectation(description: "Send mail with Bcc.")
let mail = Mail(from: from, to: [to], bcc: [to2], subject: #function)
@@ -159,10 +147,10 @@ class TestMailSender: 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
@@ -171,17 +159,17 @@ class TestMailSender: 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 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()
}
})
}
}
+15 -3
View File
@@ -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??="
@@ -98,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)
@@ -117,13 +129,13 @@ extension TestMiscellaneous {
// User
extension TestMiscellaneous {
func testMimeNoName() {
let user = User(email: "bob@gmail.com")
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 = User(name: "Bob", email: "bob@gmail.com")
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()
}
}
}
+22 -11
View File
@@ -14,6 +14,7 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enumerations Reference"></a>
@@ -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>
@@ -69,14 +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/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="Structs/User.html">User</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>
@@ -85,7 +100,7 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
@@ -117,17 +132,13 @@
<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>
@@ -149,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>
@@ -164,8 +175,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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 -30
View File
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5A2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5A2CmF">cramMD5</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
</code>
</div>
<div class="height-container">
@@ -123,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:9SwiftSMTP10AuthMethodO5loginA2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginA2CmF">login</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
</code>
</div>
<div class="height-container">
@@ -154,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:9SwiftSMTP10AuthMethodO5plainA2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainA2CmF">plain</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
</code>
</div>
<div class="height-container">
@@ -185,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:9SwiftSMTP10AuthMethodO7xoauth2A2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2A2CmF">xoauth2</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
</code>
</div>
<div class="height-container">
@@ -216,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>
@@ -231,8 +234,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
+86 -113
View File
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailACSS6string_tcACmF"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailACSS6string_tcACmF">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">
@@ -123,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:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailA2CmF"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailA2CmF">md5HashChallengeFail</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
</code>
</div>
<div class="height-container">
@@ -154,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:9SwiftSMTP9SMTPErrorO12fileNotFoundACSS4path_tcACmF"></a>
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundACSS4path_tcACmF">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">
@@ -185,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:9SwiftSMTP9SMTPErrorO22noSupportedAuthMethodsACSS8hostname_tcACmF"></a>
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22noSupportedAuthMethodsACSS8hostname_tcACmF">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">
@@ -209,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>SSL</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:9SwiftSMTP9SMTPErrorO13noAccessTokenA2CmF"></a>
<a name="//apple_ref/swift/Element/noAccessToken" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO13noAccessTokenA2CmF">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:9SwiftSMTP9SMTPErrorO12noRecipientsA2CmF"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF"></a>
<a name="//apple_ref/swift/Element/noRecipients" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsA2CmF">noRecipients</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF">noRecipients</a>
</code>
</div>
<div class="height-container">
@@ -280,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:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedA2CmF"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF"></a>
<a name="//apple_ref/swift/Element/createEmailRegexFailed" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedA2CmF">createEmailRegexFailed</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF">createEmailRegexFailed</a>
</code>
</div>
<div class="height-container">
@@ -311,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:9SwiftSMTP9SMTPErrorO11badResponseACSS7command_SS8responsetcACmF"></a>
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11badResponseACSS7command_SS8responsetcACmF">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">
@@ -342,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:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailAC10Foundation0E0V4data_tcACmF"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailAC10Foundation0E0V4data_tcACmF">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">
@@ -373,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:9SwiftSMTP9SMTPErrorO12invalidEmailACSS5email_tcACmF"></a>
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12invalidEmailACSS5email_tcACmF">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">
@@ -397,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:9SwiftSMTP9SMTPErrorO11descriptionSSv"></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:9SwiftSMTP9SMTPErrorO11descriptionSSv">description</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
@@ -435,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>
@@ -450,8 +423,8 @@ without an access token.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
+27 -55
View File
@@ -14,6 +14,7 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
<a title="Structures Reference"></a>
@@ -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>
@@ -69,14 +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/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="Structs/User.html">User</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>
@@ -85,7 +100,7 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
@@ -118,17 +133,14 @@ 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>
@@ -150,17 +162,13 @@ 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>
@@ -174,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, authenticate, 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>
@@ -182,17 +190,13 @@ 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>
@@ -206,7 +210,7 @@ Different SMTP servers have different attachment size limits.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Configuration for connecting with TLS. For more info, see <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/TLSConfiguration.html" class="slightly-smaller">See more</a>
</div>
@@ -214,39 +218,7 @@ 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">TLSConfiguration</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:9SwiftSMTP4UserV"></a>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4UserV">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>
@@ -261,8 +233,8 @@ Different SMTP servers have different attachment size limits.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
+58 -15
View File
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -107,9 +123,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentVAC10Foundation4DataV4data_SS4mimeSS4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc"></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:9SwiftSMTP10AttachmentVAC10Foundation4DataV4data_SS4mimeSS4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc">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">
@@ -124,7 +140,7 @@ 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>
<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>
@@ -225,9 +241,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentVACSS8filePath_SS4mimeSSSg4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc"></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:9SwiftSMTP10AttachmentVACSS8filePath_SS4mimeSSSg4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc">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">
@@ -242,7 +258,7 @@ 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>
<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>
@@ -343,9 +359,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentVACSS11htmlContent_SS12characterSetSb11alternatives10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc"></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:9SwiftSMTP10AttachmentVACSS11htmlContent_SS12characterSetSb11alternatives10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc">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">
@@ -360,7 +376,7 @@ 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>
<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>
@@ -443,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>
@@ -451,8 +494,8 @@ Different SMTP servers have different attachment size limits.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
+103 -60
View File
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4uuidSSv"></a>
<a name="/s:9SwiftSMTP4MailV4uuidSSvp"></a>
<a name="//apple_ref/swift/Property/uuid" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSv">uuid</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSvp">uuid</a>
</code>
</div>
<div class="height-container">
@@ -123,7 +138,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">let</span> <span class="nv">uuid</span> <span class="o">=</span> <span class="kt">UUID</span><span class="p">()</span><span class="o">.</span><span class="n">uuidString</span></code></pre>
<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>
@@ -133,9 +148,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4fromAA4UserVv"></a>
<a name="/s:9SwiftSMTP4MailV4fromAC4UserVvp"></a>
<a name="//apple_ref/swift/Property/from" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAA4UserVv">from</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAC4UserVvp">from</a>
</code>
</div>
<div class="height-container">
@@ -143,14 +158,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The <code><a href="../Structs/User.html">User</a></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>
<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="k">let</span> <span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/User.html">User</a></span></code></pre>
<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>
@@ -160,9 +175,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2toSayAA4UserVGv"></a>
<a name="/s:9SwiftSMTP4MailV2toSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/to" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAA4UserVGv">to</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAC4UserVGvp">to</a>
</code>
</div>
<div class="height-container">
@@ -170,14 +185,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/User.html">User</a></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>
<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="k">let</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></code></pre>
<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>
@@ -187,9 +202,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2ccSayAA4UserVGv"></a>
<a name="/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/cc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAA4UserVGv">cc</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp">cc</a>
</code>
</div>
<div class="height-container">
@@ -197,14 +212,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/User.html">User</a></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>
<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="k">let</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></code></pre>
<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>
@@ -214,9 +229,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV3bccSayAA4UserVGv"></a>
<a name="/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/bcc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAA4UserVGv">bcc</a>
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp">bcc</a>
</code>
</div>
<div class="height-container">
@@ -224,14 +239,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/User.html">User</a></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>
<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="k">let</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></code></pre>
<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>
@@ -241,9 +256,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV7subjectSSv"></a>
<a name="/s:9SwiftSMTP4MailV7subjectSSvp"></a>
<a name="//apple_ref/swift/Property/subject" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSv">subject</a>
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSvp">subject</a>
</code>
</div>
<div class="height-container">
@@ -258,7 +273,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">let</span> <span class="nv">subject</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">let</span> <span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -268,9 +283,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4textSSv"></a>
<a name="/s:9SwiftSMTP4MailV4textSSvp"></a>
<a name="//apple_ref/swift/Property/text" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSv">text</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSvp">text</a>
</code>
</div>
<div class="height-container">
@@ -285,7 +300,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">let</span> <span class="nv">text</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">let</span> <span class="nv">text</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -295,9 +310,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGv"></a>
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp"></a>
<a name="//apple_ref/swift/Property/attachments" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGv">attachments</a>
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp">attachments</a>
</code>
</div>
<div class="height-container">
@@ -313,7 +328,7 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><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>
<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>
@@ -323,9 +338,9 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgv"></a>
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp"></a>
<a name="//apple_ref/swift/Property/alternative" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgv">alternative</a>
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp">alternative</a>
</code>
</div>
<div class="height-container">
@@ -340,7 +355,7 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><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>
<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>
@@ -350,9 +365,9 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV17additionalHeaderss10DictionaryVyS2SGv"></a>
<a name="/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp"></a>
<a name="//apple_ref/swift/Property/additionalHeaders" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeaderss10DictionaryVyS2SGv">additionalHeaders</a>
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp">additionalHeaders</a>
</code>
</div>
<div class="height-container">
@@ -368,7 +383,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><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>
<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>
@@ -378,9 +393,9 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2idSSv"></a>
<a name="/s:9SwiftSMTP4MailV2idSSvp"></a>
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSv">id</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSvp">id</a>
</code>
</div>
<div class="height-container">
@@ -395,7 +410,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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>
@@ -405,9 +420,9 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV8hostnameSSv"></a>
<a name="/s:9SwiftSMTP4MailV8hostnameSSvp"></a>
<a name="//apple_ref/swift/Property/hostname" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSv">hostname</a>
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSvp">hostname</a>
</code>
</div>
<div class="height-container">
@@ -422,7 +437,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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">hostname</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">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>
@@ -432,9 +447,9 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailVAcA4UserV4from_SayAEG2toAG2ccAG3bccSS7subjectSS4textSayAA10AttachmentVG11attachmentss10DictionaryVyS2SG17additionalHeaderstcfc"></a>
<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:9SwiftSMTP4MailVAcA4UserV4from_SayAEG2toAG2ccAG3bccSS7subjectSS4textSayAA10AttachmentVG11attachmentss10DictionaryVyS2SG17additionalHeaderstcfc">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">
@@ -449,10 +464,10 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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>
<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>
@@ -472,7 +487,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>The <code><a href="../Structs/User.html">User</a></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>
@@ -484,7 +499,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>Array of <code><a href="../Structs/User.html">User</a></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>
@@ -496,7 +511,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>Array of <code><a href="../Structs/User.html">User</a></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>
@@ -508,7 +523,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>Array of <code><a href="../Structs/User.html">User</a></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>
@@ -545,8 +560,8 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<td>
<div>
<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>
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>
@@ -559,8 +574,8 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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>
overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION,
CONTENT-TRANSFER-ENCODING.</p>
</div>
</td>
</tr>
@@ -570,6 +585,34 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</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>
@@ -578,8 +621,8 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
+75 -47
View File
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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, authenticate, and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
</div>
</section>
@@ -106,9 +121,37 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0VACSS8hostname_SS5emailSS8passwords5Int32V4portSb6useTLSAA16TLSConfigurationVSg16tlsConfigurationSayAA10AuthMethodOG11authMethodsSSSg11accessTokenSS10domainNameSu7timeouttcfc"></a>
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:useTLS:tlsConfiguration:authMethods:accessToken:domainName:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0VACSS8hostname_SS5emailSS8passwords5Int32V4portSb6useTLSAA16TLSConfigurationVSg16tlsConfigurationSayAA10AuthMethodOG11authMethodsSSSg11accessTokenSS10domainNameSu7timeouttcfc">init(hostname:email:password:port:useTLS:tlsConfiguration:authMethods:accessToken:domainName: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">
@@ -122,9 +165,9 @@
<p>Note:</p>
<ul>
<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>
<li>You may need to enable access for less secure apps in your account on the SMTP server.</li>
</ul>
</div>
@@ -134,14 +177,13 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<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>
<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">465</span><span class="p">,</span>
<span class="nv">useTLS</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">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">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">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>
@@ -159,8 +201,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
</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>
@@ -184,7 +225,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
</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>
@@ -203,13 +244,12 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<tr>
<td>
<code>
<em>useTLS</em>
<em>tlsMode</em>
</code>
</td>
<td>
<div>
<p><code>Bool</code> indicating whether to connect with TLS. Your server must support the <code>STARTTLS</code> command.
Defaults to <code>true</code>.</p>
<p>TLSMode <code>enum</code> indicating what form of connection security to use.</p>
</div>
</td>
</tr>
@@ -222,7 +262,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<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>
certificates is used. See <code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> for other configuration options.</p>
</div>
</td>
</tr>
@@ -234,19 +274,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
</td>
<td>
<div>
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. Defaults to <code>CRAM-MD5</code>, <code>LOGIN</code>, and <code>PLAIN</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>accessToken</em>
</code>
</td>
<td>
<div>
<p>Access token used IFF logging in through <code>XOAUTH2</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>
@@ -283,9 +311,9 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V4sendyAA4MailV_ys5Error_pSgcSg10completiontF"></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:9SwiftSMTP0B0V4sendyAA4MailV_ys5Error_pSgcSg10completiontF">send(_:completion:)</a>
<a class="token" href="#/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF">send(_:<wbr>completion:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -300,7 +328,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<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>
@@ -341,9 +369,9 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V4sendySayAA4MailVG_yAF_s5Error_pSgtcSg8progressyAG_SayAF_sAH_ptGtcSg10completiontF"></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:9SwiftSMTP0B0V4sendySayAA4MailVG_yAF_s5Error_pSgtcSg8progressyAG_SayAF_sAH_ptGtcSg10completiontF">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">
@@ -374,9 +402,9 @@ in separate calls to <code>send</code>.</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">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>
@@ -404,8 +432,8 @@ in separate calls to <code>send</code>.</li>
</td>
<td>
<div>
<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 <code><a href="../Structs/Mail.html">Mail</a></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>
@@ -418,8 +446,8 @@ in separate calls to <code>send</code>.</li>
<td>
<div>
<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>
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>
@@ -437,8 +465,8 @@ in separate calls to <code>send</code>.</li>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
+47 -20
View File
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,15 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<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">TLSConfiguration</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 for connecting with TLS. For more info, see <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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg15withCipherSuite_Sb34clientAllowsSelfSignedCertificatestcfc"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc"></a>
<a name="//apple_ref/swift/Method/init(withCipherSuite:clientAllowsSelfSignedCertificates:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationVACSSSg15withCipherSuite_Sb34clientAllowsSelfSignedCertificatestcfc">init(withCipherSuite:clientAllowsSelfSignedCertificates:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc">init(withCipherSuite:<wbr>clientAllowsSelfSignedCertificates:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -123,7 +138,7 @@
<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>
<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>
@@ -165,9 +180,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg25withCACertificateFilePath_AD016usingCertificateF0AD0d3KeyF0Sb0H15SelfSignedCertsAD11cipherSuitetcfc"></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:9SwiftSMTP16TLSConfigurationVACSSSg25withCACertificateFilePath_AD016usingCertificateF0AD0d3KeyF0Sb0H15SelfSignedCertsAD11cipherSuitetcfc">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">
@@ -182,7 +197,7 @@
<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>
<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>
@@ -263,9 +278,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg26withCACertificateDirectory_AD20usingCertificateFileAD0d3KeyI0Sb0G15SelfSignedCertsAD11cipherSuitetcfc"></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:9SwiftSMTP16TLSConfigurationVACSSSg26withCACertificateDirectory_AD20usingCertificateFileAD0d3KeyI0Sb0G15SelfSignedCertsAD11cipherSuitetcfc">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">
@@ -282,7 +297,7 @@
<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>
<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>
@@ -363,9 +378,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg17withChainFilePath_AD0D8PasswordSb20usingSelfSignedCertsSb012clientAllowsjK12CertificatesAD11cipherSuitetcfc"></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:9SwiftSMTP16TLSConfigurationVACSSSg17withChainFilePath_AD0D8PasswordSb20usingSelfSignedCertsSb012clientAllowsjK12CertificatesAD11cipherSuitetcfc">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">
@@ -382,7 +397,7 @@
<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>
<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>
@@ -430,6 +445,18 @@
</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>
@@ -453,7 +480,7 @@
<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">
@@ -475,8 +502,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
-177
View File
@@ -1,177 +0,0 @@
<!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/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 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/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</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:9SwiftSMTP4UserVACSSSg4name_SS5emailtcfc"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4UserVACSSSg4name_SS5emailtcfc">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; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
+182
View File
@@ -0,0 +1,182 @@
<!DOCTYPE html>
<html lang="en">
<head>
<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">
<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/Section/Type Aliases" class="dashAnchor"></a>
<a title="Type Aliases 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" />
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">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>Type Aliases</h1>
<p>The following type aliases are available globally.</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: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">
<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>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 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>
</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>
+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; }
@@ -14,6 +14,7 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enumerations Reference"></a>
@@ -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>
@@ -69,14 +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/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="Structs/User.html">User</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>
@@ -85,7 +100,7 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
@@ -117,17 +132,13 @@
<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>
@@ -149,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>
@@ -164,8 +175,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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,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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5A2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5A2CmF">cramMD5</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
</code>
</div>
<div class="height-container">
@@ -123,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:9SwiftSMTP10AuthMethodO5loginA2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginA2CmF">login</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
</code>
</div>
<div class="height-container">
@@ -154,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:9SwiftSMTP10AuthMethodO5plainA2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainA2CmF">plain</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
</code>
</div>
<div class="height-container">
@@ -185,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:9SwiftSMTP10AuthMethodO7xoauth2A2CmF"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2A2CmF">xoauth2</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
</code>
</div>
<div class="height-container">
@@ -216,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>
@@ -231,8 +234,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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,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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailACSS6string_tcACmF"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailACSS6string_tcACmF">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">
@@ -123,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:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailA2CmF"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailA2CmF">md5HashChallengeFail</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
</code>
</div>
<div class="height-container">
@@ -154,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:9SwiftSMTP9SMTPErrorO12fileNotFoundACSS4path_tcACmF"></a>
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundACSS4path_tcACmF">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">
@@ -185,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:9SwiftSMTP9SMTPErrorO22noSupportedAuthMethodsACSS8hostname_tcACmF"></a>
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22noSupportedAuthMethodsACSS8hostname_tcACmF">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">
@@ -209,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>SSL</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:9SwiftSMTP9SMTPErrorO13noAccessTokenA2CmF"></a>
<a name="//apple_ref/swift/Element/noAccessToken" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO13noAccessTokenA2CmF">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:9SwiftSMTP9SMTPErrorO12noRecipientsA2CmF"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF"></a>
<a name="//apple_ref/swift/Element/noRecipients" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsA2CmF">noRecipients</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF">noRecipients</a>
</code>
</div>
<div class="height-container">
@@ -280,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:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedA2CmF"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF"></a>
<a name="//apple_ref/swift/Element/createEmailRegexFailed" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedA2CmF">createEmailRegexFailed</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF">createEmailRegexFailed</a>
</code>
</div>
<div class="height-container">
@@ -311,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:9SwiftSMTP9SMTPErrorO11badResponseACSS7command_SS8responsetcACmF"></a>
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11badResponseACSS7command_SS8responsetcACmF">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">
@@ -342,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:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailAC10Foundation0E0V4data_tcACmF"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailAC10Foundation0E0V4data_tcACmF">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">
@@ -373,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:9SwiftSMTP9SMTPErrorO12invalidEmailACSS5email_tcACmF"></a>
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12invalidEmailACSS5email_tcACmF">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">
@@ -397,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:9SwiftSMTP9SMTPErrorO11descriptionSSv"></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:9SwiftSMTP9SMTPErrorO11descriptionSSv">description</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
@@ -435,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>
@@ -450,8 +423,8 @@ without an access token.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
@@ -14,6 +14,7 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
<a title="Structures Reference"></a>
@@ -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>
@@ -69,14 +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/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="Structs/User.html">User</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>
@@ -85,7 +100,7 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
@@ -118,17 +133,14 @@ 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>
@@ -150,17 +162,13 @@ 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>
@@ -174,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, authenticate, 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>
@@ -182,17 +190,13 @@ 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>
@@ -206,7 +210,7 @@ Different SMTP servers have different attachment size limits.</p>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Configuration for connecting with TLS. For more info, see <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/TLSConfiguration.html" class="slightly-smaller">See more</a>
</div>
@@ -214,39 +218,7 @@ 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">TLSConfiguration</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:9SwiftSMTP4UserV"></a>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4UserV">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>
@@ -261,8 +233,8 @@ Different SMTP servers have different attachment size limits.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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,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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -107,9 +123,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentVAC10Foundation4DataV4data_SS4mimeSS4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc"></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:9SwiftSMTP10AttachmentVAC10Foundation4DataV4data_SS4mimeSS4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc">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">
@@ -124,7 +140,7 @@ 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>
<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>
@@ -225,9 +241,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentVACSS8filePath_SS4mimeSSSg4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc"></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:9SwiftSMTP10AttachmentVACSS8filePath_SS4mimeSSSg4nameSb6inlines10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc">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">
@@ -242,7 +258,7 @@ 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>
<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>
@@ -343,9 +359,9 @@ Different SMTP servers have different attachment size limits.</p>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentVACSS11htmlContent_SS12characterSetSb11alternatives10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc"></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:9SwiftSMTP10AttachmentVACSS11htmlContent_SS12characterSetSb11alternatives10DictionaryVyS2SG17additionalHeadersSayACG18relatedAttachmentstcfc">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">
@@ -360,7 +376,7 @@ 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>
<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>
@@ -443,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>
@@ -451,8 +494,8 @@ Different SMTP servers have different attachment size limits.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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,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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4uuidSSv"></a>
<a name="/s:9SwiftSMTP4MailV4uuidSSvp"></a>
<a name="//apple_ref/swift/Property/uuid" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSv">uuid</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSvp">uuid</a>
</code>
</div>
<div class="height-container">
@@ -123,7 +138,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">let</span> <span class="nv">uuid</span> <span class="o">=</span> <span class="kt">UUID</span><span class="p">()</span><span class="o">.</span><span class="n">uuidString</span></code></pre>
<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>
@@ -133,9 +148,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4fromAA4UserVv"></a>
<a name="/s:9SwiftSMTP4MailV4fromAC4UserVvp"></a>
<a name="//apple_ref/swift/Property/from" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAA4UserVv">from</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAC4UserVvp">from</a>
</code>
</div>
<div class="height-container">
@@ -143,14 +158,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The <code><a href="../Structs/User.html">User</a></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>
<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="k">let</span> <span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/User.html">User</a></span></code></pre>
<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>
@@ -160,9 +175,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2toSayAA4UserVGv"></a>
<a name="/s:9SwiftSMTP4MailV2toSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/to" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAA4UserVGv">to</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAC4UserVGvp">to</a>
</code>
</div>
<div class="height-container">
@@ -170,14 +185,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/User.html">User</a></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>
<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="k">let</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></code></pre>
<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>
@@ -187,9 +202,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2ccSayAA4UserVGv"></a>
<a name="/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/cc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAA4UserVGv">cc</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp">cc</a>
</code>
</div>
<div class="height-container">
@@ -197,14 +212,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/User.html">User</a></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>
<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="k">let</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></code></pre>
<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>
@@ -214,9 +229,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV3bccSayAA4UserVGv"></a>
<a name="/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp"></a>
<a name="//apple_ref/swift/Property/bcc" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAA4UserVGv">bcc</a>
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp">bcc</a>
</code>
</div>
<div class="height-container">
@@ -224,14 +239,14 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Array of <code><a href="../Structs/User.html">User</a></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>
<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="k">let</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></code></pre>
<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>
@@ -241,9 +256,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV7subjectSSv"></a>
<a name="/s:9SwiftSMTP4MailV7subjectSSvp"></a>
<a name="//apple_ref/swift/Property/subject" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSv">subject</a>
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSvp">subject</a>
</code>
</div>
<div class="height-container">
@@ -258,7 +273,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">let</span> <span class="nv">subject</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">let</span> <span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -268,9 +283,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4textSSv"></a>
<a name="/s:9SwiftSMTP4MailV4textSSvp"></a>
<a name="//apple_ref/swift/Property/text" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSv">text</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSvp">text</a>
</code>
</div>
<div class="height-container">
@@ -285,7 +300,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">let</span> <span class="nv">text</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">let</span> <span class="nv">text</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -295,9 +310,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGv"></a>
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp"></a>
<a name="//apple_ref/swift/Property/attachments" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGv">attachments</a>
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp">attachments</a>
</code>
</div>
<div class="height-container">
@@ -313,7 +328,7 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><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>
<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>
@@ -323,9 +338,9 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgv"></a>
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp"></a>
<a name="//apple_ref/swift/Property/alternative" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgv">alternative</a>
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp">alternative</a>
</code>
</div>
<div class="height-container">
@@ -340,7 +355,7 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><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>
<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>
@@ -350,9 +365,9 @@ text, the last one will be used as the alternative (all the <code>Attachments</c
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV17additionalHeaderss10DictionaryVyS2SGv"></a>
<a name="/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp"></a>
<a name="//apple_ref/swift/Property/additionalHeaders" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeaderss10DictionaryVyS2SGv">additionalHeaders</a>
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp">additionalHeaders</a>
</code>
</div>
<div class="height-container">
@@ -368,7 +383,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><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>
<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>
@@ -378,9 +393,9 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV2idSSv"></a>
<a name="/s:9SwiftSMTP4MailV2idSSvp"></a>
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSv">id</a>
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSvp">id</a>
</code>
</div>
<div class="height-container">
@@ -395,7 +410,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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>
@@ -405,9 +420,9 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV8hostnameSSv"></a>
<a name="/s:9SwiftSMTP4MailV8hostnameSSvp"></a>
<a name="//apple_ref/swift/Property/hostname" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSv">hostname</a>
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSvp">hostname</a>
</code>
</div>
<div class="height-container">
@@ -422,7 +437,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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">hostname</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">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>
@@ -432,9 +447,9 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailVAcA4UserV4from_SayAEG2toAG2ccAG3bccSS7subjectSS4textSayAA10AttachmentVG11attachmentss10DictionaryVyS2SG17additionalHeaderstcfc"></a>
<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:9SwiftSMTP4MailVAcA4UserV4from_SayAEG2toAG2ccAG3bccSS7subjectSS4textSayAA10AttachmentVG11attachmentss10DictionaryVyS2SG17additionalHeaderstcfc">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">
@@ -449,10 +464,10 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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>
<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>
@@ -472,7 +487,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>The <code><a href="../Structs/User.html">User</a></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>
@@ -484,7 +499,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>Array of <code><a href="../Structs/User.html">User</a></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>
@@ -496,7 +511,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>Array of <code><a href="../Structs/User.html">User</a></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>
@@ -508,7 +523,7 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</td>
<td>
<div>
<p>Array of <code><a href="../Structs/User.html">User</a></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>
@@ -545,8 +560,8 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<td>
<div>
<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>
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>
@@ -559,8 +574,8 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
<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>
overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION,
CONTENT-TRANSFER-ENCODING.</p>
</div>
</td>
</tr>
@@ -570,6 +585,34 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</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>
@@ -578,8 +621,8 @@ Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITI
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,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, authenticate, and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
</div>
</section>
@@ -106,9 +121,37 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0VACSS8hostname_SS5emailSS8passwords5Int32V4portSb6useTLSAA16TLSConfigurationVSg16tlsConfigurationSayAA10AuthMethodOG11authMethodsSSSg11accessTokenSS10domainNameSu7timeouttcfc"></a>
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:useTLS:tlsConfiguration:authMethods:accessToken:domainName:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0VACSS8hostname_SS5emailSS8passwords5Int32V4portSb6useTLSAA16TLSConfigurationVSg16tlsConfigurationSayAA10AuthMethodOG11authMethodsSSSg11accessTokenSS10domainNameSu7timeouttcfc">init(hostname:email:password:port:useTLS:tlsConfiguration:authMethods:accessToken:domainName: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">
@@ -122,9 +165,9 @@
<p>Note:</p>
<ul>
<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>
<li>You may need to enable access for less secure apps in your account on the SMTP server.</li>
</ul>
</div>
@@ -134,14 +177,13 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<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>
<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">465</span><span class="p">,</span>
<span class="nv">useTLS</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">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">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">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>
@@ -159,8 +201,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
</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>
@@ -184,7 +225,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
</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>
@@ -203,13 +244,12 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<tr>
<td>
<code>
<em>useTLS</em>
<em>tlsMode</em>
</code>
</td>
<td>
<div>
<p><code>Bool</code> indicating whether to connect with TLS. Your server must support the <code>STARTTLS</code> command.
Defaults to <code>true</code>.</p>
<p>TLSMode <code>enum</code> indicating what form of connection security to use.</p>
</div>
</td>
</tr>
@@ -222,7 +262,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<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>
certificates is used. See <code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> for other configuration options.</p>
</div>
</td>
</tr>
@@ -234,19 +274,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
</td>
<td>
<div>
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. Defaults to <code>CRAM-MD5</code>, <code>LOGIN</code>, and <code>PLAIN</code>.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>accessToken</em>
</code>
</td>
<td>
<div>
<p>Access token used IFF logging in through <code>XOAUTH2</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>
@@ -283,9 +311,9 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V4sendyAA4MailV_ys5Error_pSgcSg10completiontF"></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:9SwiftSMTP0B0V4sendyAA4MailV_ys5Error_pSgcSg10completiontF">send(_:completion:)</a>
<a class="token" href="#/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF">send(_:<wbr>completion:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -300,7 +328,7 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<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>
@@ -341,9 +369,9 @@ IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V4sendySayAA4MailVG_yAF_s5Error_pSgtcSg8progressyAG_SayAF_sAH_ptGtcSg10completiontF"></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:9SwiftSMTP0B0V4sendySayAA4MailVG_yAF_s5Error_pSgtcSg8progressyAG_SayAF_sAH_ptGtcSg10completiontF">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">
@@ -374,9 +402,9 @@ in separate calls to <code>send</code>.</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">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>
@@ -404,8 +432,8 @@ in separate calls to <code>send</code>.</li>
</td>
<td>
<div>
<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 <code><a href="../Structs/Mail.html">Mail</a></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>
@@ -418,8 +446,8 @@ in separate calls to <code>send</code>.</li>
<td>
<div>
<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>
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>
@@ -437,8 +465,8 @@ in separate calls to <code>send</code>.</li>
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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>
@@ -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>
@@ -70,14 +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/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="../Structs/User.html">User</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>
@@ -86,15 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<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">TLSConfiguration</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 for connecting with TLS. For more info, see <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>
@@ -106,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg15withCipherSuite_Sb34clientAllowsSelfSignedCertificatestcfc"></a>
<a name="/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc"></a>
<a name="//apple_ref/swift/Method/init(withCipherSuite:clientAllowsSelfSignedCertificates:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationVACSSSg15withCipherSuite_Sb34clientAllowsSelfSignedCertificatestcfc">init(withCipherSuite:clientAllowsSelfSignedCertificates:)</a>
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc">init(withCipherSuite:<wbr>clientAllowsSelfSignedCertificates:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -123,7 +138,7 @@
<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>
<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>
@@ -165,9 +180,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg25withCACertificateFilePath_AD016usingCertificateF0AD0d3KeyF0Sb0H15SelfSignedCertsAD11cipherSuitetcfc"></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:9SwiftSMTP16TLSConfigurationVACSSSg25withCACertificateFilePath_AD016usingCertificateF0AD0d3KeyF0Sb0H15SelfSignedCertsAD11cipherSuitetcfc">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">
@@ -182,7 +197,7 @@
<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>
<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>
@@ -263,9 +278,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg26withCACertificateDirectory_AD20usingCertificateFileAD0d3KeyI0Sb0G15SelfSignedCertsAD11cipherSuitetcfc"></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:9SwiftSMTP16TLSConfigurationVACSSSg26withCACertificateDirectory_AD20usingCertificateFileAD0d3KeyI0Sb0G15SelfSignedCertsAD11cipherSuitetcfc">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">
@@ -282,7 +297,7 @@
<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>
<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>
@@ -363,9 +378,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP16TLSConfigurationVACSSSg17withChainFilePath_AD0D8PasswordSb20usingSelfSignedCertsSb012clientAllowsjK12CertificatesAD11cipherSuitetcfc"></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:9SwiftSMTP16TLSConfigurationVACSSSg17withChainFilePath_AD0D8PasswordSb20usingSelfSignedCertsSb012clientAllowsjK12CertificatesAD11cipherSuitetcfc">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">
@@ -382,7 +397,7 @@
<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>
<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>
@@ -430,6 +445,18 @@
</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>
@@ -453,7 +480,7 @@
<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">
@@ -475,8 +502,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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,177 +0,0 @@
<!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/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 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/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</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:9SwiftSMTP4UserVACSSSg4name_SS5emailtcfc"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4UserVACSSSg4name_SS5emailtcfc">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; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -0,0 +1,182 @@
<!DOCTYPE html>
<html lang="en">
<head>
<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">
<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/Section/Type Aliases" class="dashAnchor"></a>
<a title="Type Aliases 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" />
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">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>Type Aliases</h1>
<p>The following type aliases are available globally.</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: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">
<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>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 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>
</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>
@@ -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>
@@ -69,14 +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/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="Structs/User.html">User</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>
@@ -85,15 +99,15 @@
<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?raw=true" 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 SMTP client.</p>
<p><img src="https://travis-ci.org/IBM-Swift/Swift-SMTP.svg?branch=master" alt="Build Status">
<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>
@@ -104,51 +118,81 @@
<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/">Fully documented</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 4.0.3</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 3.0.0 brings breaking changes. See the quick migration guide <a href="https://github.com/IBM-Swift/Swift-SMTP/blob/master/migration-guide.md">here</a>.</p>
<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><a href="Structs/SMTP.html">SMTP</a></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">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="p">)</span> <span class="c1">// password to login</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='tls' class='heading'>TLS</h3>
<p>All parameters of <code><a href="Structs/SMTP.html">SMTP</a></code> struct:</p>
<pre class="highlight swift"><code><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="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">465</span><span class="p">,</span>
<span class="nv">useTLS</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">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">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">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>
<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>465</code> and tries to connect using TLS. It also uses a <code><a href="Structs/TLSConfiguration.html">TLSConfiguration</a></code> that uses no backing certificates. Configure these to your needs. For more info on <code><a href="Structs/TLSConfiguration.html">TLSConfiguration</a></code>, view the <a href="https://ibm-swift.github.io/Swift-SMTP/Structs/TLSConfiguration.html">docs</a>.</p>
<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><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><a href="Structs/User.html">User</a></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">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>
@@ -158,15 +202,17 @@
</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>
@@ -174,26 +220,37 @@
<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>
@@ -219,7 +276,7 @@
</code></pre>
<h2 id='acknowledgements' class='heading'>Acknowledgements</h2>
<p><code>Swift-SMTP</code> was inspired by two other Swift SMTP clients, <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>.</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 v2.0</p>
@@ -231,8 +288,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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.
+114 -57
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>
@@ -69,14 +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/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="Structs/User.html">User</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>
@@ -85,15 +99,15 @@
<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?raw=true" 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 SMTP client.</p>
<p><img src="https://travis-ci.org/IBM-Swift/Swift-SMTP.svg?branch=master" alt="Build Status">
<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>
@@ -104,51 +118,81 @@
<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/">Fully documented</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 4.0.3</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 3.0.0 brings breaking changes. See the quick migration guide <a href="https://github.com/IBM-Swift/Swift-SMTP/blob/master/migration-guide.md">here</a>.</p>
<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><a href="Structs/SMTP.html">SMTP</a></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">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="p">)</span> <span class="c1">// password to login</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='tls' class='heading'>TLS</h3>
<p>All parameters of <code><a href="Structs/SMTP.html">SMTP</a></code> struct:</p>
<pre class="highlight swift"><code><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="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">465</span><span class="p">,</span>
<span class="nv">useTLS</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">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">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">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>
<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>465</code> and tries to connect using TLS. It also uses a <code><a href="Structs/TLSConfiguration.html">TLSConfiguration</a></code> that uses no backing certificates. Configure these to your needs. For more info on <code><a href="Structs/TLSConfiguration.html">TLSConfiguration</a></code>, view the <a href="https://ibm-swift.github.io/Swift-SMTP/Structs/TLSConfiguration.html">docs</a>.</p>
<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><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><a href="Structs/User.html">User</a></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">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>
@@ -158,15 +202,17 @@
</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>
@@ -174,26 +220,37 @@
<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>
@@ -219,7 +276,7 @@
</code></pre>
<h2 id='acknowledgements' class='heading'>Acknowledgements</h2>
<p><code>Swift-SMTP</code> was inspired by two other Swift SMTP clients, <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>.</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 v2.0</p>
@@ -231,8 +288,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2018 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2018-04-05)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.0</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"
}
+57 -11
View File
@@ -1,3 +1,49 @@
# 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`
@@ -16,19 +62,19 @@ public init(hostname: String,
timeout: UInt = 10)
```
`3.0.0`+:
After `3.0.0`:
```swift
let smtp = SMTP(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)
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