Compare commits
92 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3eaa80f5db | |||
| 0501eae561 | |||
| 4b7666bb8c | |||
| f9b1d704b1 | |||
| 697e73a5e3 | |||
| d892f67ddb | |||
| 75ba1b9c0f | |||
| a24f187755 | |||
| f9e34156c6 | |||
| 35c690956d | |||
| 2725933a65 | |||
| 23360cff5f | |||
| beed3112da | |||
| 3f2a7b5c45 | |||
| 99b56a8c86 | |||
| a34267c2a3 | |||
| 6ce4e31e68 | |||
| b924fdd720 | |||
| ea7345ca02 | |||
| 51c1bc2093 | |||
| 3eb07d4750 | |||
| 1b58530701 | |||
| 496f779a07 | |||
| 08e0bd81ea | |||
| 77ebc1dfd8 | |||
| ec3fa120e5 | |||
| dbce8d5319 | |||
| b0c2a4c1f4 | |||
| 979acff232 | |||
| eb67bd618c | |||
| 737bd39423 | |||
| 15af9fd9b0 | |||
| 54fbbb90df | |||
| b6ca1eaf6f | |||
| 3958929e16 | |||
| 64bcdee9d5 | |||
| c6349a40ce | |||
| 56faca1e20 | |||
| 38b59b6979 | |||
| f19bbdd632 | |||
| 9ae5aa4837 | |||
| 0b2e1b1156 | |||
| bd65a508af | |||
| 7bdf6e2796 | |||
| b91c8e2cbb | |||
| 55679ee569 | |||
| e44a3fa946 | |||
| 780246c7c9 | |||
| 79109bb764 | |||
| 2709ff59f4 | |||
| d6e90c00c0 | |||
| 094e4b2748 | |||
| c7a579b94b | |||
| cd0e6d89f8 | |||
| 4b07014698 | |||
| 205c7464ab | |||
| 32deefbde2 | |||
| bac7092b49 | |||
| fc59def561 | |||
| cdad458f28 | |||
| a6cc32cdbc | |||
| e1bdcee0f2 | |||
| d9405067a3 | |||
| adf8489453 | |||
| f7b8f2bcea | |||
| 2d1eabc6f4 | |||
| de20450050 | |||
| 2cafbdcfee | |||
| 189561aaf5 | |||
| ba023428ea | |||
| fa9c072c38 | |||
| 371e86d961 | |||
| faaf45bd54 | |||
| 6b4c0ecf0b | |||
| 348813c8f9 | |||
| 3234f54d99 | |||
| 8bf457d080 | |||
| 4a925e7853 | |||
| 313a9f27f0 | |||
| 8653499940 | |||
| 7aea5baa54 | |||
| aeb8636baa | |||
| 993afe2ae0 | |||
| d6a0c2b7be | |||
| d7a673880a | |||
| cb7b77912f | |||
| ba0d320750 | |||
| d9faf228d7 | |||
| af8c69eb78 | |||
| 0d3fb77eea | |||
| 0faf214fe1 | |||
| d459dbcbaf |
@@ -0,0 +1,34 @@
|
||||
# Contributing to IBM-Swift
|
||||
|
||||
We welcome contributions, and request you follow these guidelines.
|
||||
|
||||
- [Raising issues](#raising-issues)
|
||||
- [Contributor License Agreement](#contributor-license-agreement)
|
||||
- [Coding Standards](#coding-standards)
|
||||
|
||||
|
||||
## Raising issues
|
||||
|
||||
Please raise any bug reports on the issue tracker. Be sure to
|
||||
search the list to see if your issue has already been raised.
|
||||
|
||||
A good bug report is one that makes it easy for us to understand what you were
|
||||
trying to do and what went wrong. Provide as much context as possible so we can try to recreate the issue.
|
||||
|
||||
### Contributor License Agreement
|
||||
|
||||
In order for us to accept pull-requests, the contributor must first complete
|
||||
a Contributor License Agreement (CLA). Please see our [CLA repo](http://github.com/IBM-Swift/CLA) for more information.
|
||||
|
||||
This clarifies the intellectual property license granted with any contribution. It is for your protection as a
|
||||
Contributor as well as the protection of IBM and its customers; it does not
|
||||
change your rights to use your own Contributions for any other purpose.
|
||||
|
||||
### Coding standards
|
||||
|
||||
Please ensure you follow [the Kitura coding standards](https://github.com/IBM-Swift/Kitura/blob/master/Documentation/CodeConventions.md)
|
||||
|
||||
Please note:
|
||||
|
||||
- all files must have the Apache license in the header.
|
||||
- all PRs must have passing builds for all operating systems.
|
||||
@@ -0,0 +1,20 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
## Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
<!--- If it fixes an open issue, please link to the issue here. -->
|
||||
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Checklist:
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
- [ ] I have submitted a [CLA form](https://github.com/IBM-Swift/CLA)
|
||||
- [ ] If applicable, I have updated the documentation accordingly.
|
||||
- [ ] If applicable, I have added tests to cover my changes.
|
||||
+3
-1
@@ -2,4 +2,6 @@
|
||||
/.build
|
||||
build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
Package.resolved
|
||||
/*.xcodeproj
|
||||
.swiftpm
|
||||
|
||||
+3
-3
@@ -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
@@ -1 +1 @@
|
||||
3.1.1
|
||||
5.1
|
||||
|
||||
+26
-8
@@ -1,25 +1,43 @@
|
||||
# Travis CI build file.
|
||||
|
||||
# whitelist (branches that should be built)
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^issue.*$/
|
||||
|
||||
# the matrix of builds should cover each combination of Swift version
|
||||
# and platform that is supported. The version of Swift used is specified
|
||||
# by .swift-version, unless SWIFT_SNAPSHOT is specified.
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: bionic
|
||||
sudo: required
|
||||
services: docker
|
||||
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu18.04:5.2.5 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
|
||||
- os: linux
|
||||
dist: trusty
|
||||
dist: focal
|
||||
sudo: required
|
||||
env: SWIFT_SNAPSHOT=4.0-DEVELOPMENT-SNAPSHOT-2017-06-11-a
|
||||
services: docker
|
||||
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu20.04:5.4 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
|
||||
- os: linux
|
||||
dist: focal
|
||||
sudo: required
|
||||
services: docker
|
||||
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu20.04:latest USE_SWIFT_DEVELOPMENT_SNAPSHOT=1 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
|
||||
- os: osx
|
||||
osx_image: xcode8.3
|
||||
osx_image: xcode12.2
|
||||
sudo: required
|
||||
env: SWIFT_SNAPSHOT=4.0-DEVELOPMENT-SNAPSHOT-2017-06-11-a
|
||||
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_USER:$GITHUB_PWD@github.com/IBM-Swift/Kitura-TestingCredentials.git
|
||||
- git clone https://github.com/Kitura/Package-Builder.git
|
||||
|
||||
script:
|
||||
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR -credentialsDir $TRAVIS_BUILD_DIR/Kitura-TestingCredentials/Swift-SMTP
|
||||
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"autoPin": false,
|
||||
"pins": [],
|
||||
"version": 1
|
||||
}
|
||||
+20
-9
@@ -1,15 +1,26 @@
|
||||
// swift-tools-version:5.0
|
||||
|
||||
import PackageDescription
|
||||
|
||||
#if os(Linux) && !swift(>=3.1.1)
|
||||
fatalError("Please use Swift >=3.1.1.")
|
||||
#else
|
||||
let package = Package(
|
||||
name: "SwiftSMTP",
|
||||
products: [
|
||||
.library(
|
||||
name: "SwiftSMTP",
|
||||
targets: ["SwiftSMTP"]),
|
||||
],
|
||||
dependencies: [
|
||||
.Package(url: "https://github.com/IBM-Swift/BlueSocket.git", majorVersion: 0, minor: 12),
|
||||
.Package(url: "https://github.com/IBM-Swift/BlueSSLService.git", majorVersion: 0, minor: 12),
|
||||
.Package(url: "https://github.com/IBM-Swift/BlueCryptor", majorVersion: 0, minor: 8),
|
||||
.Package(url: "https://github.com/IBM-Swift/LoggerAPI.git", majorVersion: 1, minor: 7)
|
||||
]
|
||||
.package(url: "https://github.com/Kitura/BlueSocket.git", from: "2.0.2"),
|
||||
.package(url: "https://github.com/Kitura/BlueSSLService.git", from: "2.0.1"),
|
||||
.package(url: "https://github.com/Kitura/BlueCryptor.git", from: "2.0.1"),
|
||||
.package(url: "https://github.com/Kitura/LoggerAPI.git", from: "1.9.200"),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "SwiftSMTP",
|
||||
dependencies: ["Socket", "SSLService", "Cryptor", "LoggerAPI"]),
|
||||
.testTarget(
|
||||
name: "SwiftSMTPTests",
|
||||
dependencies: ["SwiftSMTP"]),
|
||||
]
|
||||
)
|
||||
#endif
|
||||
|
||||
@@ -1,72 +1,112 @@
|
||||
# Swift-SMTP
|
||||
|
||||

|
||||

|
||||
|
||||
Swift package for sending emails to an SMTP server.
|
||||
Swift SMTP client.
|
||||
|
||||
[](https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master)
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Features
|
||||
|
||||
- Connect securely through SSL/TLS if available
|
||||
- Connect securely through SSL/TLS when needed
|
||||
- Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2
|
||||
- Send emails with local file, HTML, and raw data attachments
|
||||
- Add custom headers
|
||||
- Asynchronous
|
||||
- [Documentation](https://ibm-swift.github.io/Swift-SMTP/)
|
||||
- [Demo & blog post](https://developer.ibm.com/swift/2017/05/31/4675/)
|
||||
- [Documentation](https://kitura.github.io/Swift-SMTP/)
|
||||
|
||||
## Swift Version
|
||||
|
||||
macOS & Linux: `Swift 3.1.1`
|
||||
macOS & Linux: `Swift 5.2` or above.
|
||||
|
||||
## Installation
|
||||
|
||||
You can add `SwiftSMTP` to your project using [Swift Package Manager](https://swift.org/package-manager/). If your project does not have a `Package.swift` file, create one by running `swift package init` in the root directory of your project. Then open `Package.swift` and add `SwiftSMTP` as a dependency. Be sure to add it to your desired targets as well:
|
||||
|
||||
```swift
|
||||
// swift-tools-version:4.0
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "MyProject",
|
||||
products: [
|
||||
.library(
|
||||
name: "MyProject",
|
||||
targets: ["MyProject"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/Kitura/Swift-SMTP", .upToNextMinor(from: "5.1.0")), // add the dependency
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "MyProject",
|
||||
dependencies: ["SwiftSMTP"]), // add targets
|
||||
.testTarget( // note "SwiftSMTP" (NO HYPHEN)
|
||||
name: "MyProjectTests",
|
||||
dependencies: ["MyProject"]),
|
||||
]
|
||||
)
|
||||
```
|
||||
|
||||
After adding the dependency and saving, run `swift package generate-xcodeproj` in the root directory of your project. This will fetch dependencies and create an Xcode project which you can open and begin editing.
|
||||
|
||||
## Migration Guide
|
||||
|
||||
Version `5.0.0` brings breaking changes. See the quick migration guide [here](https://github.com/Kitura/Swift-SMTP/blob/master/migration-guide.md).
|
||||
|
||||
## Usage
|
||||
|
||||
Use the `SMTP` struct as a handle to your SMTP server. If your server requires a SSL/TLS connection, you can specify an `SSL` config and include it in your `SMTP` handle:
|
||||
Initialize an `SMTP` instance:
|
||||
|
||||
```swift
|
||||
import SwiftSMTP
|
||||
|
||||
// Create an `SSL` config
|
||||
#if os(Linux)
|
||||
let certificateFilePath = "~/cert.pem"
|
||||
let keyFilePath = "~/key.pem"
|
||||
let ssl = SSL(withCACertificateDirectory: nil, usingCertificateFile: certificateFilePath, withKeyFile: keyFilePath)
|
||||
#else
|
||||
let chainFilePath = "~/cert.pfx"
|
||||
let certPassword = "password"
|
||||
let ssl = SSL(withChainFilePath: chainFilePath, withPassword: certPassword)
|
||||
#endif
|
||||
/* Additional methods available to create an `SSL` config */
|
||||
|
||||
// Create your `SMTP` handle
|
||||
let smtp = SMTP(hostname: "smtp.gmail.com", // SMTP server address
|
||||
user: "user@gmail.com", // username to login
|
||||
password: "password", // password to login
|
||||
ssl: ssl) // if your SMTP server requires SSL/TLS
|
||||
|
||||
/* Additional parameters available to further customize your `SMTP` handle */
|
||||
let smtp = SMTP(
|
||||
hostname: "smtp.gmail.com", // SMTP server address
|
||||
email: "user@gmail.com", // username to login
|
||||
password: "password" // password to login
|
||||
)
|
||||
```
|
||||
|
||||
### TLS
|
||||
|
||||
Additional parameters of `SMTP` struct:
|
||||
|
||||
```swift
|
||||
public init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Int32 = 587,
|
||||
tlsMode: TLSMode = .requireSTARTTLS,
|
||||
tlsConfiguration: TLSConfiguration? = nil,
|
||||
authMethods: [AuthMethod] = [],
|
||||
domainName: String = "localhost",
|
||||
timeout: UInt = 10)
|
||||
```
|
||||
|
||||
By default, the `SMTP` struct connects on port `587` and sends mail only if a TLS connection can be established. It also uses a `TLSConfiguration` that uses no backing certificates. View the [docs](https://kitura.github.io/Swift-SMTP/) for more configuration options.
|
||||
|
||||
### Send email
|
||||
|
||||
Create a `Mail` object and use your `smtp` handle to send it. To set the sender and receiver of an email, use the `User` struct:
|
||||
Create a `Mail` object and use your `SMTP` handle to send it. To set the sender and receiver of an email, use the `User` struct:
|
||||
|
||||
```swift
|
||||
let drLight = User(name: "Dr. Light", email: "drlight@gmail.com")
|
||||
let megaman = User(name: "Megaman", email: "megaman@gmail.com")
|
||||
let drLight = Mail.User(name: "Dr. Light", email: "drlight@gmail.com")
|
||||
let megaman = Mail.User(name: "Megaman", email: "megaman@gmail.com")
|
||||
|
||||
let mail = Mail(from: drLight,
|
||||
to: [megaman],
|
||||
subject: "Humans and robots living together in harmony and equality.",
|
||||
text: "That was my ultimate wish.")
|
||||
let mail = Mail(
|
||||
from: drLight,
|
||||
to: [megaman],
|
||||
subject: "Humans and robots living together in harmony and equality.",
|
||||
text: "That was my ultimate wish."
|
||||
)
|
||||
|
||||
smtp.send(mail) { (err) in
|
||||
if let err = err {
|
||||
print(err)
|
||||
smtp.send(mail) { (error) in
|
||||
if let error = error {
|
||||
print(error)
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -74,45 +114,58 @@ smtp.send(mail) { (err) in
|
||||
Add Cc and Bcc:
|
||||
|
||||
```swift
|
||||
let roll = User(name: "Roll", email: "roll@gmail.com")
|
||||
let zero = User(name: "Zero", email: "zero@gmail.com")
|
||||
let roll = Mail.User(name: "Roll", email: "roll@gmail.com")
|
||||
let zero = Mail.User(name: "Zero", email: "zero@gmail.com")
|
||||
|
||||
let mail = Mail(from: drLight,
|
||||
to: [megaman],
|
||||
cc: [roll],
|
||||
bcc: [zero],
|
||||
subject: "Robots should be used for the betterment of mankind.",
|
||||
text: "Any other use would be...unethical.")
|
||||
let mail = Mail(
|
||||
from: drLight,
|
||||
to: [megaman],
|
||||
cc: [roll],
|
||||
bcc: [zero],
|
||||
subject: "Robots should be used for the betterment of mankind.",
|
||||
text: "Any other use would be...unethical."
|
||||
)
|
||||
|
||||
smtp.send(mail)
|
||||
```
|
||||
|
||||
### Send attachments
|
||||
|
||||
Create an `Attachment`, attach it to your `Mail`, and send it through the `smtp` handle. Here's an example of how you can send the three supported types of attachments--a local file, HTML, and raw data:
|
||||
Create an `Attachment`, attach it to your `Mail`, and send it through the `SMTP` handle. Here's an example of how you can send the three supported types of attachments--a local file, HTML, and raw data:
|
||||
|
||||
```swift
|
||||
// Create a file `Attachment`
|
||||
let fileAttachment = Attachment(filePath: "~/img.png",
|
||||
// You can add "CONTENT-ID" to reference this in another attachment
|
||||
additionalHeaders: ["CONTENT-ID": "img001"])
|
||||
let fileAttachment = Attachment(
|
||||
filePath: "~/img.png",
|
||||
// "CONTENT-ID" lets you reference this in another attachment
|
||||
additionalHeaders: ["CONTENT-ID": "img001"]
|
||||
)
|
||||
|
||||
// Create an HTML `Attachment`
|
||||
let htmlAttachment = Attachment(htmlContent: "<html>Here's an image: <img src=\"cid:img001\"/></html>",
|
||||
related: [fileAttachment]) // to reference `fileAttachment`
|
||||
let htmlAttachment = Attachment(
|
||||
htmlContent: "<html>Here's an image: <img src=\"cid:img001\"/></html>",
|
||||
// To reference `fileAttachment`
|
||||
related: [fileAttachment]
|
||||
)
|
||||
|
||||
// Create a data `Attachment`
|
||||
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
|
||||
let dataAttachment = Attachment(data: data,
|
||||
mime: "application/json",
|
||||
name: "file.json",
|
||||
inline: false) // send as a standalone attachment
|
||||
let dataAttachment = Attachment(
|
||||
data: data,
|
||||
mime: "application/json",
|
||||
name: "file.json",
|
||||
// send as a standalone attachment
|
||||
inline: false
|
||||
)
|
||||
|
||||
// Create a `Mail` and include the `Attachment`s
|
||||
let mail = Mail(from: from,
|
||||
to: [to],
|
||||
subject: "Check out this image and JSON file!",
|
||||
attachments: [htmlAttachment, dataAttachment]) // attachments we created earlier
|
||||
let mail = Mail(
|
||||
from: from,
|
||||
to: [to],
|
||||
subject: "Check out this image and JSON file!",
|
||||
// The attachments we created earlier
|
||||
attachments: [htmlAttachment, dataAttachment]
|
||||
)
|
||||
|
||||
// Send the mail
|
||||
smtp.send(mail)
|
||||
@@ -126,12 +179,12 @@ smtp.send(mail)
|
||||
let mail1: Mail = //...
|
||||
let mail2: Mail = //...
|
||||
|
||||
smtp.send([mail1, mail2],
|
||||
smtp.send([mail1, mail2],
|
||||
// This optional callback gets called after each `Mail` is sent.
|
||||
// `mail` is the attempted `Mail`, `error` is the error if one occured.
|
||||
progress: { (mail, error) in
|
||||
},
|
||||
|
||||
|
||||
// This optional callback gets called after all the mails have been sent.
|
||||
// `sent` is an array of the successfully sent `Mail`s.
|
||||
// `failed` is an array of (Mail, Error)--the failed `Mail`s and their corresponding errors.
|
||||
@@ -142,8 +195,8 @@ smtp.send([mail1, mail2],
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
`Swift-SMTP` was inspired by [Hedwig](https://github.com/onevcat/Hedwig) and [Perfect-SMTP](https://github.com/PerfectlySoft/Perfect-SMTP), two Swift packages that can also be used to send emails to an SMTP server.
|
||||
Inspired by [Hedwig](https://github.com/onevcat/Hedwig) and [Perfect-SMTP](https://github.com/PerfectlySoft/Perfect-SMTP).
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
Apache v2.0
|
||||
|
||||
@@ -1,214 +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
|
||||
|
||||
typealias LoginCallback = ((SMTPSocket?, Error?) -> Void)
|
||||
|
||||
class Login {
|
||||
fileprivate let hostname: String
|
||||
fileprivate let email: String
|
||||
fileprivate let password: String
|
||||
fileprivate let port: Port
|
||||
fileprivate let ssl: SSL?
|
||||
fileprivate let authMethods: [AuthMethod]
|
||||
fileprivate let domainName: String
|
||||
fileprivate let accessToken: String?
|
||||
fileprivate let timeout: Int
|
||||
fileprivate var callback: LoginCallback
|
||||
fileprivate var socket: SMTPSocket
|
||||
|
||||
init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Port,
|
||||
ssl: SSL?,
|
||||
authMethods: [AuthMethod],
|
||||
domainName: String,
|
||||
accessToken: String?,
|
||||
timeout: Int,
|
||||
callback: @escaping LoginCallback) throws {
|
||||
self.hostname = hostname
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.port = port
|
||||
self.ssl = ssl
|
||||
self.authMethods = authMethods
|
||||
self.domainName = domainName
|
||||
self.accessToken = accessToken
|
||||
self.timeout = timeout
|
||||
self.callback = callback
|
||||
socket = try SMTPSocket()
|
||||
}
|
||||
|
||||
func login() {
|
||||
DispatchQueue.global().async {
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
|
||||
// We call `async` again here because trying to connect to an SMTP
|
||||
// server on a port it doesn't accept hangs the entire process.
|
||||
// By calling `async` again, we can call `wait` on a separate thread
|
||||
// and report an error in these cases.
|
||||
DispatchQueue.global().async {
|
||||
do {
|
||||
try self.connect(self.port)
|
||||
try self.loginToServer()
|
||||
group.leave()
|
||||
self.callback(self.socket, nil)
|
||||
} catch {
|
||||
group.leave()
|
||||
self.callback(nil, error)
|
||||
}
|
||||
}
|
||||
|
||||
if group.wait(timeout: DispatchTime.now() + .seconds(self.timeout)) == .timedOut {
|
||||
self.socket.close()
|
||||
self.callback(nil,
|
||||
SMTPError(.couldNotConnectToServer(server: self.hostname,
|
||||
timeout: self.timeout)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension Login {
|
||||
func connect(_ port: Port) throws {
|
||||
try socket.connect(to: hostname, port: port)
|
||||
_ = try SMTPSocket.parseResponses(try socket.readFromSocket(),
|
||||
command: .connect)
|
||||
}
|
||||
|
||||
func loginToServer() throws {
|
||||
var serverInfo = try getServerInfo()
|
||||
|
||||
if let ssl = ssl, doesStarttls(serverInfo) {
|
||||
try starttls(ssl)
|
||||
try connect(Ports.ssl.rawValue)
|
||||
serverInfo = try getServerInfo()
|
||||
}
|
||||
|
||||
switch try getAuthMethod(serverInfo) {
|
||||
case .cramMD5: try loginCramMD5()
|
||||
case .login: try loginLogin()
|
||||
case .plain: try loginPlain()
|
||||
case .xoauth2: try loginXOAuth2()
|
||||
}
|
||||
}
|
||||
|
||||
func getServerInfo() throws -> [Response] {
|
||||
do {
|
||||
return try ehlo()
|
||||
} catch {
|
||||
return try helo()
|
||||
}
|
||||
}
|
||||
|
||||
func doesStarttls(_ serverInfo: [Response]) -> Bool {
|
||||
return serverInfo.contains { $0.message.contains("STARTTLS") }
|
||||
}
|
||||
|
||||
func starttls(_ ssl: SSL) throws {
|
||||
try starttls()
|
||||
socket.close()
|
||||
socket = try SMTPSocket()
|
||||
socket.setDelegate(try ssl.makeSSLService())
|
||||
}
|
||||
|
||||
func getAuthMethod(_ serverInfo: [Response]) throws -> AuthMethod {
|
||||
for res in serverInfo {
|
||||
let resArr = res.message.components(separatedBy: " ")
|
||||
if resArr.first == "AUTH" {
|
||||
let args = resArr.dropFirst()
|
||||
for arg in args {
|
||||
if let authMethod = AuthMethod(rawValue: arg),
|
||||
authMethods.contains(authMethod)
|
||||
{
|
||||
return authMethod
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw SMTPError(.noSupportedAuthMethods(hostname: hostname))
|
||||
}
|
||||
}
|
||||
|
||||
private extension Login {
|
||||
func loginCramMD5() throws {
|
||||
let challenge = try auth(authMethod: .cramMD5,
|
||||
credentials: nil).message
|
||||
try authPassword(try AuthEncoder.cramMD5(challenge: challenge,
|
||||
user: email,
|
||||
password: password))
|
||||
}
|
||||
|
||||
func loginLogin() throws {
|
||||
try auth(authMethod: .login, credentials: nil)
|
||||
let credentials = AuthEncoder.login(user: email, password: password)
|
||||
try authUser(credentials.encodedUser)
|
||||
try authPassword(credentials.encodedPassword)
|
||||
}
|
||||
|
||||
func loginPlain() throws {
|
||||
try auth(authMethod: .plain,
|
||||
credentials: AuthEncoder.plain(user: email,
|
||||
password: password))
|
||||
}
|
||||
|
||||
func loginXOAuth2() throws {
|
||||
guard let accessToken = accessToken else {
|
||||
throw SMTPError(.noAccessToken)
|
||||
}
|
||||
try auth(authMethod: .xoauth2,
|
||||
credentials: AuthEncoder.xoauth2(user: email,
|
||||
accessToken: accessToken))
|
||||
}
|
||||
}
|
||||
|
||||
private extension Login {
|
||||
func ehlo() throws -> [Response] {
|
||||
return try socket.send(.ehlo(domainName))
|
||||
}
|
||||
|
||||
func helo() throws -> [Response] {
|
||||
return try socket.send(.helo(domainName))
|
||||
}
|
||||
|
||||
func starttls() throws {
|
||||
try socket.send(.starttls)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func auth(authMethod: AuthMethod, credentials: String?) throws -> Response {
|
||||
let response = try socket.send(.auth(authMethod, credentials))
|
||||
guard response.count == 1 else {
|
||||
throw SMTPError(.badResponse(command: "AUTH", response: response.description))
|
||||
}
|
||||
return response[0]
|
||||
}
|
||||
|
||||
func authUser(_ user: String) throws {
|
||||
try socket.send(.authUser(user))
|
||||
}
|
||||
|
||||
func authPassword(_ password: String) throws {
|
||||
try socket.send(.authPassword(password))
|
||||
}
|
||||
}
|
||||
@@ -1,130 +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 an email that can be sent through an `SMTP` instance.
|
||||
public struct Mail {
|
||||
/// UUID of the `Mail`.
|
||||
public let id = UUID().uuidString + ".Swift-SMTP"
|
||||
|
||||
let from: User
|
||||
let to: [User]
|
||||
let cc: [User]
|
||||
let bcc: [User]
|
||||
let subject: String
|
||||
let text: String
|
||||
let attachments: [Attachment]
|
||||
let alternative: Attachment?
|
||||
let additionalHeaders: [Header]
|
||||
|
||||
/// Initializes a `Mail` object.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - from: The `User` that the `Mail` will be sent from.
|
||||
/// - to: Array of `User`s to send the `Mail` to.
|
||||
/// - cc: Array of `User`s to cc. Defaults to none.
|
||||
/// - bcc: Array of `User`s to bcc. Defaults to none.
|
||||
/// - subject: Subject of the `Mail`. Defaults to none.
|
||||
/// - text: Text of the `Mail`. Defaults to none.
|
||||
/// - attachments: Array of `Attachment`s for the `Mail`. If the `Mail`
|
||||
/// has multiple `Attachment`s that are alternatives to
|
||||
/// to plain text, the last one will be used as the
|
||||
/// alternative (all the `Attachments` will still be
|
||||
/// sent). Defaults to none.
|
||||
/// - additionalHeaders: Additional headers for the `Mail`. Defaults to
|
||||
/// none.
|
||||
public init(from: User,
|
||||
to: [User],
|
||||
cc: [User] = [],
|
||||
bcc: [User] = [],
|
||||
subject: String = "",
|
||||
text: String = "",
|
||||
attachments: [Attachment] = [],
|
||||
additionalHeaders: [Header] = []) {
|
||||
self.from = from
|
||||
self.to = to
|
||||
self.cc = cc
|
||||
self.bcc = bcc
|
||||
self.subject = subject
|
||||
self.text = text
|
||||
|
||||
let (alternative, attachments) = Mail.getAlternative(attachments)
|
||||
self.alternative = alternative
|
||||
self.attachments = attachments
|
||||
|
||||
self.additionalHeaders = additionalHeaders
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
return (nil, attachments)
|
||||
}
|
||||
}
|
||||
|
||||
extension Mail {
|
||||
private var headers: [Header] {
|
||||
var headers = [Header]()
|
||||
|
||||
headers.append(("MESSAGE-ID", id))
|
||||
headers.append(("DATE", Date().smtpFormatted))
|
||||
headers.append(("FROM", from.mime))
|
||||
headers.append(("TO", to.map { $0.mime }.joined(separator: ", ")))
|
||||
|
||||
if !cc.isEmpty {
|
||||
headers.append(("CC", cc.map { $0.mime }.joined(separator: ", ")))
|
||||
}
|
||||
|
||||
headers.append(("SUBJECT", subject.mimeEncoded ?? ""))
|
||||
headers.append(("MIME-VERSION", "1.0 (Swift-SMTP)"))
|
||||
|
||||
for header in additionalHeaders {
|
||||
headers.append((header.header, header.value))
|
||||
}
|
||||
|
||||
return headers
|
||||
}
|
||||
|
||||
var headersString: String {
|
||||
return headers.map {
|
||||
"\($0.0): \($0.1)"
|
||||
}.joined(separator: CRLF)
|
||||
}
|
||||
}
|
||||
|
||||
extension Mail {
|
||||
var hasAttachment: Bool {
|
||||
return !attachments.isEmpty || alternative != nil
|
||||
}
|
||||
}
|
||||
|
||||
extension DateFormatter {
|
||||
static let smtpDateFormatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "EEE, d MMM yyyy HH:mm:ss ZZZ"
|
||||
return formatter
|
||||
}()
|
||||
}
|
||||
|
||||
extension Date {
|
||||
var smtpFormatted: String {
|
||||
return DateFormatter.smtpDateFormatter.string(from: self)
|
||||
}
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Port to connect to SMTP server with.
|
||||
public typealias Port = Int32
|
||||
|
||||
/// Common `Port`s.
|
||||
public enum Ports: Port {
|
||||
/// Default `Port`.
|
||||
case tls = 587
|
||||
/// `Port` used to connect securely.
|
||||
case ssl = 465
|
||||
}
|
||||
|
||||
/// Supported authentication methods for logging into the SMTP server.
|
||||
public enum AuthMethod: String {
|
||||
/// CRAM-MD5 authentication.
|
||||
case cramMD5 = "CRAM-MD5"
|
||||
/// LOGIN authentication.
|
||||
case login = "LOGIN"
|
||||
/// PLAIN authentication.
|
||||
case plain = "PLAIN"
|
||||
/// XOAUTH2 authentication. Requires a valid access token.
|
||||
case xoauth2 = "XOAUTH2"
|
||||
}
|
||||
|
||||
/// Represents a handle to connect to and send emails to an SMTP server.
|
||||
public struct SMTP {
|
||||
private let hostname: String
|
||||
private let email: String
|
||||
private let password: String
|
||||
private let port: Port
|
||||
private let ssl: SSL?
|
||||
private let authMethods: [AuthMethod]
|
||||
private let domainName: String
|
||||
private let accessToken: String?
|
||||
private let timeout: Int
|
||||
|
||||
/// Initializes an `SMTP` instance.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - hostname: Hostname of the SMTP server to connect to. Should not
|
||||
/// include any scheme--ie `smtp.example.com` is valid.
|
||||
/// - user: Username to log in to server.
|
||||
/// - password: Password to log in to server.
|
||||
/// - port: `Port` to connect to the server on. Defaults to `587`.
|
||||
/// - ssl: `SSL` containing configuration info for connecting securely
|
||||
/// through SSL/TLS. (optional)
|
||||
/// - authMethods: `AuthMethod`s to use to log in to the
|
||||
/// server. Defaults to `CRAM-MD5`, `LOGIN`, and `PLAIN`.
|
||||
/// - domainName: Client domain name used when communicating with the
|
||||
/// server. Defaults to `localhost`.
|
||||
/// - accessToken: Access token used if logging in through `XOAUTH2`.
|
||||
/// (optional)
|
||||
/// - timeout: How long to try connecting to the server to before
|
||||
/// returning an error. Defaults to `10` seconds.
|
||||
///
|
||||
/// - Note:
|
||||
/// - Some servers like Gmail support IPv6, and if your network does
|
||||
/// not, you will first attempt to connect via IPv6, then timeout, and
|
||||
/// fall back to IPv4. You can avoid this by disabling IPv6 on your
|
||||
/// machine.
|
||||
///
|
||||
/// - You may need to enable access for less secure apps in your account
|
||||
/// on the SMTP server.
|
||||
public init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Port = Ports.tls.rawValue,
|
||||
ssl: SSL? = nil,
|
||||
authMethods: [AuthMethod] = [],
|
||||
domainName: String = "localhost",
|
||||
accessToken: String? = nil,
|
||||
timeout: Int = 10) {
|
||||
self.hostname = hostname
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.port = port
|
||||
self.ssl = ssl
|
||||
|
||||
if !authMethods.isEmpty {
|
||||
self.authMethods = authMethods
|
||||
} else {
|
||||
self.authMethods = [AuthMethod.cramMD5,
|
||||
AuthMethod.login,
|
||||
AuthMethod.plain]
|
||||
}
|
||||
|
||||
self.domainName = domainName
|
||||
self.accessToken = accessToken
|
||||
self.timeout = timeout
|
||||
}
|
||||
|
||||
/// Send an email.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - mail: `Mail` object to send.
|
||||
/// - completion: Callback when sending finishes. `Error` is nil on
|
||||
/// success. (optional)
|
||||
public func send(_ mail: Mail, completion: ((Error?) -> Void)? = nil) {
|
||||
send([mail]) { (_, failed) in
|
||||
if let error = failed.first?.1 {
|
||||
completion?(error)
|
||||
} else {
|
||||
completion?(nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Send multiple emails.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - mails: Array of `Mail`s to send.
|
||||
/// - progress: (`Mail`, `Error`) callback after each `Mail` is sent.
|
||||
/// `Mail` is the `Mail` sent and `Error` is the error if it
|
||||
/// failed. (optional)
|
||||
/// - completion: ([`Mail`], [(`Mail`, `Error`)]) callback after all
|
||||
/// `Mail`s have been attempted. [`Mail`] is an array of
|
||||
/// successfully sent `Mail`s. [(`Mail`, `Error`)] is an
|
||||
/// array of failed `Mail`s and their corresponding
|
||||
/// `Error`s. (optional)
|
||||
///
|
||||
/// - Note:
|
||||
/// - If any of the emails addresses in a `Mail`'s `to`, `cc`, or `bcc`
|
||||
/// are invalid, the entire mail will not send and return an
|
||||
/// `SMTPError`.
|
||||
///
|
||||
/// - If an individual `Mail` fails while sending an array of `Mail`s,
|
||||
/// the whole sending process will not stop until all pending `Mail`s
|
||||
/// are attempted.
|
||||
///
|
||||
/// - Each call to `send` queues it's `Mail`s and sends them one by one.
|
||||
/// To send `Mail`s concurrently, send them in separate calls to
|
||||
/// `send`.
|
||||
public func send(_ mails: [Mail],
|
||||
progress: Progress = nil,
|
||||
completion: Completion = nil) {
|
||||
do {
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: accessToken,
|
||||
timeout: timeout) { (socket, error) in
|
||||
if let error = error {
|
||||
completion?([], mails.map { ($0, error) })
|
||||
return
|
||||
}
|
||||
if let socket = socket {
|
||||
Sender(socket: socket,
|
||||
pending: mails,
|
||||
progress: progress,
|
||||
completion: completion).send()
|
||||
}
|
||||
}.login()
|
||||
} catch {
|
||||
completion?([], mails.map { ($0, error) })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
import Socket
|
||||
import LoggerAPI
|
||||
|
||||
// Wrapper around BlueSocket
|
||||
struct SMTPSocket {
|
||||
// The socket we use to read and write to
|
||||
fileprivate let socket: Socket
|
||||
|
||||
// Init a new instance of SMTPSocket
|
||||
init() throws {
|
||||
socket = try Socket.create()
|
||||
}
|
||||
|
||||
// Connect to the SMTP server at `port`
|
||||
func connect(to: String, port: Port) throws {
|
||||
try socket.connect(to: to, port: port)
|
||||
}
|
||||
|
||||
// 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.verbose(text)
|
||||
}
|
||||
|
||||
// Write `data` to the socket
|
||||
func write(_ data: Data) throws {
|
||||
_ = try socket.write(from: data)
|
||||
Log.verbose("(sending data)")
|
||||
}
|
||||
}
|
||||
|
||||
extension SMTPSocket {
|
||||
// Read all the data out of the socket
|
||||
// Returns a string representation of the data
|
||||
// The string could be one or more responses
|
||||
// Throws an error if a string could not be created from the data
|
||||
func readFromSocket() throws -> String {
|
||||
var buf = Data()
|
||||
_ = try socket.read(into: &buf)
|
||||
guard let responses = String(data: buf, encoding: .utf8) else {
|
||||
throw SMTPError(.convertDataUTF8Fail(data: buf))
|
||||
}
|
||||
Log.verbose(responses)
|
||||
return responses
|
||||
}
|
||||
|
||||
// Parses through each response and creates a `Response` from it
|
||||
// Returns an array of these `Response`s
|
||||
// Throws an error if no/invalid response found
|
||||
static func parseResponses(_ responses: String, command: Command) throws -> [Response] {
|
||||
let resArr = responses.components(separatedBy: CRLF)
|
||||
guard !resArr.isEmpty else {
|
||||
throw SMTPError(.badResponse(command: command.text, response: responses))
|
||||
}
|
||||
var validResponses = [Response]()
|
||||
for res in resArr {
|
||||
if res == "" { break }
|
||||
validResponses.append(Response(code: try getResponseCode(res, command: command),
|
||||
message: getResponseMessage(res),
|
||||
response: res))
|
||||
}
|
||||
return validResponses
|
||||
}
|
||||
|
||||
// Returns a `ResponseCode` extracted from the `response`
|
||||
// Throws an error if no/invalid response code found
|
||||
static func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
|
||||
guard
|
||||
response.characters.count > 2,
|
||||
let code = Int(response.substring(to: response.index(response.startIndex,
|
||||
offsetBy: 3))),
|
||||
command.expectedResponseCodes.map({ $0.rawValue }).contains(code) else {
|
||||
throw SMTPError(.badResponse(command: command.text,
|
||||
response: response))
|
||||
}
|
||||
return ResponseCode(code)
|
||||
}
|
||||
|
||||
// Returns the reponse message from the response
|
||||
static func getResponseMessage(_ response: String) -> String {
|
||||
if response.characters.count < 4 { return "" }
|
||||
return response.substring(from: response.index(response.startIndex,
|
||||
offsetBy: 4))
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
import SSLService
|
||||
|
||||
/// Configuration to connect securely through SSL/TLS.
|
||||
/// https://github.com/IBM-Swift/BlueSSLService
|
||||
public struct SSL {
|
||||
let config: SSLService.Configuration
|
||||
|
||||
#if os(Linux)
|
||||
/// Initialize a configuration using a `CA Certificate` file.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - caCertificateFilePath: Path to the PEM formatted CA certificate file.
|
||||
/// - certificateFilePath: Path to the PEM formatted certificate file.
|
||||
/// - keyFilePath: Path to the PEM formatted key file. If nil, `certificateFilePath` will be used.
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withCACertificateFilePath caCertificateFilePath: String?, usingCertificateFile certificateFilePath: String?, withKeyFile keyFilePath: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
|
||||
config = SSLService.Configuration(withCACertificateFilePath: caCertificateFilePath,
|
||||
usingCertificateFile: certificateFilePath,
|
||||
withKeyFile: keyFilePath,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
cipherSuite: cipherSuite)
|
||||
}
|
||||
|
||||
/// Initialize a configuration using a `CA Certificate` directory.
|
||||
///
|
||||
/// *Note:* `caCertificateDirPath` - All certificates in the specified directory **must** be hashed using the `OpenSSL Certificate Tool`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - caCertificateDirPath: Path to a directory containing CA certificates. *(see note above)*
|
||||
/// - certificateFilePath: Path to the PEM formatted certificate file. If nil, `certificateFilePath` will be used.
|
||||
/// - keyFilePath: Path to the PEM formatted key file (optional). If nil, `certificateFilePath` is used.
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withCACertificateDirectory caCertificateDirPath: String?, usingCertificateFile certificateFilePath: String?, withKeyFile keyFilePath: String? = nil, usingSelfSignedCerts selfSigned: Bool = true, cipherSuite: String? = nil) {
|
||||
config = SSLService.Configuration(withCACertificateDirectory: caCertificateDirPath,
|
||||
usingCertificateFile: certificateFilePath,
|
||||
withKeyFile: keyFilePath,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
cipherSuite: cipherSuite)
|
||||
}
|
||||
|
||||
/// Initialize a configuration with no backing certificates.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withCipherSuite cipherSuite: String?) {
|
||||
config = SSLService.Configuration(withCipherSuite: cipherSuite)
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Initialize a configuration using a `Certificate Chain File`.
|
||||
///
|
||||
/// *Note:* If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject's certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - chainFilePath: Path to the certificate chain file (optional). *(see note above)*
|
||||
/// - password: Password for the chain file (optional).
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withChainFilePath chainFilePath: String? = nil,
|
||||
withPassword password: String? = nil,
|
||||
usingSelfSignedCerts selfSigned: Bool = true,
|
||||
cipherSuite: String? = nil) {
|
||||
config = SSLService.Configuration(withChainFilePath: chainFilePath,
|
||||
withPassword: password,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
clientAllowsSelfSignedCertificates: selfSigned,
|
||||
cipherSuite: cipherSuite)
|
||||
}
|
||||
|
||||
func makeSSLService() throws -> SSLService? {
|
||||
return try SSLService(usingConfiguration: config)
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import Foundation
|
||||
/// Different SMTP servers have different attachment size limits.
|
||||
public struct Attachment {
|
||||
let type: AttachmentType
|
||||
let additionalHeaders: [Header]
|
||||
let additionalHeaders: [String: String]
|
||||
let relatedAttachments: [Attachment]
|
||||
|
||||
/// Initialize a data `Attachment`.
|
||||
@@ -32,15 +32,18 @@ public struct Attachment {
|
||||
/// - inline: Indicates if attachment is inline. To embed the attachment
|
||||
/// in mail content, set to `true`. To send as standalone
|
||||
/// attachment, set to `false`. Defaults to `false`.
|
||||
/// - additionalHeaders: Additional headers for the attachment. 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.
|
||||
/// - related: Related `Attachment`s of this attachment. Defaults to
|
||||
/// none.
|
||||
public init(data: Data,
|
||||
mime: String,
|
||||
name: String,
|
||||
inline: Bool = false,
|
||||
additionalHeaders: [Header] = [],
|
||||
additionalHeaders: [String: String] = [:],
|
||||
relatedAttachments: [Attachment] = []) {
|
||||
self.init(type: .data(data: data,
|
||||
mime: mime,
|
||||
@@ -61,15 +64,16 @@ public struct Attachment {
|
||||
/// - inline: Indicates if attachment is inline. To embed the attachment
|
||||
/// in mail content, set to `true`. To send as standalone
|
||||
/// attachment, set to `false`. Defaults to `false`.
|
||||
/// - additionalHeaders: Additional headers for the attachment. Defaults
|
||||
/// to none.
|
||||
/// - additionalHeaders: Additional headers for the attachment. Header
|
||||
/// keys are capitalized and duplicate keys will
|
||||
/// replace each other. Defaults to none.
|
||||
/// - related: Related `Attachment`s of this attachment. Defaults to
|
||||
/// none.
|
||||
public init(filePath: String,
|
||||
mime: String = "application/octet-stream",
|
||||
name: String? = nil,
|
||||
inline: Bool = false,
|
||||
additionalHeaders: [Header] = [],
|
||||
additionalHeaders: [String: String] = [:],
|
||||
relatedAttachments: [Attachment] = []) {
|
||||
let name = name ?? NSString(string: filePath).lastPathComponent
|
||||
self.init(type: .file(path: filePath,
|
||||
@@ -88,14 +92,15 @@ public struct Attachment {
|
||||
/// `utf-8`.
|
||||
/// - alternative: Whether the HTML is an alternative for plain text or
|
||||
/// not. Defaults to `true`.
|
||||
/// - additionalHeaders: Additional headers for the attachment. Defaults
|
||||
/// to none.
|
||||
/// - additionalHeaders: Additional headers for the attachment. Header
|
||||
/// keys are capitalized and duplicate keys will
|
||||
/// replace each other. Defaults to none.
|
||||
/// - related: Related `Attachment`s of this attachment. Defaults to
|
||||
/// none.
|
||||
public init(htmlContent: String,
|
||||
characterSet: String = "utf-8",
|
||||
alternative: Bool = true,
|
||||
additionalHeaders: [Header] = [],
|
||||
additionalHeaders: [String: String] = [:],
|
||||
relatedAttachments: [Attachment] = []) {
|
||||
self.init(type: .html(content: htmlContent,
|
||||
characterSet: characterSet,
|
||||
@@ -105,7 +110,7 @@ public struct Attachment {
|
||||
}
|
||||
|
||||
private init(type: AttachmentType,
|
||||
additionalHeaders: [Header],
|
||||
additionalHeaders: [String: String],
|
||||
relatedAttachments: [Attachment]) {
|
||||
self.type = type
|
||||
self.additionalHeaders = additionalHeaders
|
||||
@@ -122,43 +127,48 @@ extension Attachment {
|
||||
}
|
||||
|
||||
extension Attachment {
|
||||
private var headers: [Header] {
|
||||
var headers = [Header]()
|
||||
|
||||
private var headersDictionary: [String: String] {
|
||||
var dictionary = [String: String]()
|
||||
switch type {
|
||||
case .data(let data):
|
||||
headers.append(("CONTENT-TYPE", data.mime))
|
||||
var attachmentDisposition = data.inline ? "inline" : "attachment"
|
||||
if let mime = data.name.mimeEncoded {
|
||||
attachmentDisposition.append("; filename=\"\(mime)\"")
|
||||
}
|
||||
headers.append(("CONTENT-DISPOSITION", attachmentDisposition))
|
||||
|
||||
case .file(let file):
|
||||
headers.append(("CONTENT-TYPE", file.mime))
|
||||
var attachmentDisposition = file.inline ? "inline" : "attachment"
|
||||
if let mime = file.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)\"")
|
||||
}
|
||||
headers.append(("CONTENT-DISPOSITION", attachmentDisposition))
|
||||
dictionary["CONTENT-DISPOSITION"] = attachmentDisposition
|
||||
|
||||
case .html(let html):
|
||||
headers.append(("CONTENT-TYPE", "text/html; charset=\(html.characterSet)"))
|
||||
headers.append(("CONTENT-DISPOSITION", "inline"))
|
||||
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 characterSet, _):
|
||||
dictionary["CONTENT-TYPE"] = "text/html; charset=\(characterSet)"
|
||||
dictionary["CONTENT-DISPOSITION"] = "inline"
|
||||
}
|
||||
|
||||
headers.append(("CONTENT-TRANSFER-ENCODING", "BASE64"))
|
||||
dictionary["CONTENT-TRANSFER-ENCODING"] = "BASE64"
|
||||
|
||||
for header in additionalHeaders {
|
||||
headers.append((header.header, header.value))
|
||||
for (key, value) in additionalHeaders {
|
||||
let keyUppercased = key.uppercased()
|
||||
if keyUppercased != "CONTENT-TYPE" &&
|
||||
keyUppercased != "CONTENT-DISPOSITION" &&
|
||||
keyUppercased != "CONTENT-TRANSFER-ENCODING" {
|
||||
dictionary[keyUppercased] = value
|
||||
}
|
||||
}
|
||||
|
||||
return headers
|
||||
return dictionary
|
||||
}
|
||||
|
||||
var headersString: String {
|
||||
return headers.map {
|
||||
"\($0.0): \($0.1)"
|
||||
return headersDictionary.map { (key, value) in
|
||||
return "\(key): \(value)"
|
||||
}.joined(separator: CRLF)
|
||||
}
|
||||
}
|
||||
@@ -169,9 +179,45 @@ extension Attachment {
|
||||
}
|
||||
|
||||
var isAlternative: Bool {
|
||||
if case .html(let html) = type, html.alternative {
|
||||
return true
|
||||
if case .html(_, _, let alternative) = type {
|
||||
return alternative
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
extension Attachment: Equatable {
|
||||
/// Returns `true` if the `Attachment`s are equal.
|
||||
public static func ==(lhs: Attachment, rhs: Attachment) -> Bool {
|
||||
return lhs.additionalHeaders == rhs.additionalHeaders &&
|
||||
lhs.hasRelated == rhs.hasRelated &&
|
||||
lhs.headersDictionary == rhs.headersDictionary &&
|
||||
lhs.isAlternative == rhs.isAlternative &&
|
||||
lhs.relatedAttachments == rhs.relatedAttachments &&
|
||||
lhs.type == rhs.type
|
||||
}
|
||||
}
|
||||
|
||||
extension Attachment.AttachmentType: Equatable {
|
||||
static func ==(lhs: Attachment.AttachmentType, rhs: Attachment.AttachmentType) -> Bool {
|
||||
switch (lhs, rhs) {
|
||||
case (let .data(data1, mime1, name1, inline1), let .data(data2, mime2, name2, inline2)):
|
||||
return data1 == data2 &&
|
||||
mime1 == mime2 &&
|
||||
name1 == name2 &&
|
||||
inline1 == inline2
|
||||
case (let .file(path1, mime1, name1, inline1), let .file(path2, mime2, name2, inline2)):
|
||||
return path1 == path2 &&
|
||||
mime1 == mime2 &&
|
||||
name1 == name2 &&
|
||||
inline1 == inline2
|
||||
case (let .html(content1, characterSet1, alternative1),
|
||||
let .html(content2, characterSet2, alternative2)):
|
||||
return content1 == content2 &&
|
||||
characterSet1 == characterSet2 &&
|
||||
alternative1 == alternative2
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,10 @@ import Cryptor
|
||||
|
||||
struct AuthEncoder {
|
||||
static func cramMD5(challenge: String, user: String, password: String) throws -> String {
|
||||
guard
|
||||
let hmac = HMAC(using: HMAC.Algorithm.md5,
|
||||
key: password).update(string: try challenge.base64Decoded())?.final()
|
||||
else {
|
||||
throw SMTPError(.md5HashChallengeFail)
|
||||
guard let hmac = HMAC(
|
||||
using: HMAC.Algorithm.md5,
|
||||
key: password).update(string: try challenge.base64Decoded())?.final() else {
|
||||
throw SMTPError.md5HashChallengeFail
|
||||
}
|
||||
let digest = CryptoUtils.hexString(from: hmac)
|
||||
return ("\(user) \(digest)").base64Encoded
|
||||
@@ -46,11 +45,9 @@ struct AuthEncoder {
|
||||
|
||||
extension String {
|
||||
func base64Decoded() throws -> String {
|
||||
guard
|
||||
let data = Data(base64Encoded: self),
|
||||
let base64Decoded = String(data: data, encoding: .utf8)
|
||||
else {
|
||||
throw SMTPError(.base64DecodeFail(string: self))
|
||||
guard let data = Data(base64Encoded: self, options: .ignoreUnknownCharacters),
|
||||
let base64Decoded = String(data: data, encoding: .utf8) else {
|
||||
throw SMTPError.base64DecodeFail(string: self)
|
||||
}
|
||||
return base64Decoded
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2018
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Supported authentication methods for logging into the SMTP server.
|
||||
public enum AuthMethod: String {
|
||||
/// CRAM-MD5 authentication.
|
||||
case cramMD5 = "CRAM-MD5"
|
||||
/// LOGIN authentication.
|
||||
case login = "LOGIN"
|
||||
/// PLAIN authentication.
|
||||
case plain = "PLAIN"
|
||||
/// XOAUTH2 authentication. Requires a valid access token.
|
||||
case xoauth2 = "XOAUTH2"
|
||||
}
|
||||
@@ -36,18 +36,16 @@ enum Command {
|
||||
case .ehlo(let domain): return "EHLO \(domain)"
|
||||
case .helo(let domain): return "HELO \(domain)"
|
||||
case .starttls: return "STARTTLS"
|
||||
|
||||
case .auth(let method, let credentials):
|
||||
if let credentials = credentials {
|
||||
return "AUTH \(method.rawValue) \(credentials)"
|
||||
} else {
|
||||
return "AUTH \(method.rawValue)"
|
||||
}
|
||||
|
||||
case .authUser(let user): return user
|
||||
case .authPassword(let password): return password
|
||||
case .mail(let from): return "MAIL FROM: <\(from)>"
|
||||
case .rcpt(let to): return "RCPT TO: <\(to)>"
|
||||
case .mail(let from): return "MAIL FROM:<\(from)>"
|
||||
case .rcpt(let to): return "RCPT TO:<\(to)>"
|
||||
case .data: return "DATA"
|
||||
case .dataEnd: return "\(CRLF)."
|
||||
case .quit: return "QUIT"
|
||||
@@ -65,9 +63,9 @@ enum Command {
|
||||
case .plain: return [.authSucceeded]
|
||||
case .xoauth2: return [.authSucceeded]
|
||||
}
|
||||
case .authUser(_): return [.containingChallenge]
|
||||
case .authUser: return [.containingChallenge]
|
||||
case .authPassword: return [.authSucceeded]
|
||||
case .rcpt(_): return [.commandOK, .willForward]
|
||||
case .rcpt: return [.commandOK, .willForward]
|
||||
case .data: return [.startMailInput]
|
||||
case .quit: return [.connectionClosing, .commandOK]
|
||||
default: return [.commandOK]
|
||||
@@ -16,17 +16,26 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Custom header for a `Mail` or `Attachment`.
|
||||
public typealias Header = (header: String, value: String)
|
||||
enum Result<T, Error> {
|
||||
case success(T)
|
||||
case failure(Error)
|
||||
}
|
||||
|
||||
let cache = NSCache<AnyObject, AnyObject>()
|
||||
let CRLF = "\r\n"
|
||||
|
||||
extension String {
|
||||
var base64Encoded: String {
|
||||
return Data(utf8).base64EncodedString()
|
||||
}
|
||||
var base64EncodedWithLineLimit: String {
|
||||
return Data(utf8).base64EncodedString(options: .lineLength76Characters)
|
||||
}
|
||||
|
||||
var mimeEncoded: String? {
|
||||
guard let encoded = addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let quoted = encoded
|
||||
.replacingOccurrences(of: "%20", with: "_")
|
||||
.replacingOccurrences(of: ",", with: "%2C")
|
||||
@@ -34,9 +43,3 @@ extension String {
|
||||
return "=?UTF-8?Q?\(quoted)?="
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
var base64Encoded: String {
|
||||
return Data(utf8).base64EncodedString()
|
||||
}
|
||||
}
|
||||
@@ -15,19 +15,15 @@
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
import LoggerAPI
|
||||
|
||||
// Used to send the content of an email--headers, text, and attachments.
|
||||
// Should only be invoked after sending the `DATA` command to the server.
|
||||
// The email is not actually sent until we have indicated that we are done
|
||||
// sending its contents with a `CRLF CRLF`.
|
||||
// The email is not actually sent until we have indicated that we are done sending its contents with a `CRLF CRLF`.
|
||||
// This is handled by `Sender`.
|
||||
struct DataSender {
|
||||
// Socket we use to read and write data to
|
||||
let socket: SMTPSocket
|
||||
|
||||
// Cache for attachments. This saves us from encoding data or creating
|
||||
// files from local files more than we need to.
|
||||
lazy var cache = NSCache<AnyObject, AnyObject>()
|
||||
private let socket: SMTPSocket
|
||||
|
||||
// Init a new instance of `DataSender`
|
||||
init(socket: SMTPSocket) {
|
||||
@@ -35,7 +31,7 @@ struct DataSender {
|
||||
}
|
||||
|
||||
// Send the text and attachments of the `mail`
|
||||
mutating func send(_ mail: Mail) throws {
|
||||
func send(_ mail: Mail) throws {
|
||||
try sendHeaders(mail.headersString)
|
||||
|
||||
if mail.hasAttachment {
|
||||
@@ -52,36 +48,34 @@ extension DataSender {
|
||||
try send(headers)
|
||||
}
|
||||
|
||||
// Send the simple text content of a `Mail`
|
||||
// Add custom/default headers to a `Mail`'s text and write it to the socket.
|
||||
func sendText(_ text: String) throws {
|
||||
let embeddedText = text.embeddedText()
|
||||
try send(embeddedText)
|
||||
try send(text.embedded)
|
||||
}
|
||||
|
||||
// Send `mail`'s content that is more than just plain text
|
||||
mutating func sendMixed(_ mail: Mail) throws {
|
||||
let boundary = String.createBoundary()
|
||||
let mixedHeader = String.mixedHeader(boundary: boundary)
|
||||
func sendMixed(_ mail: Mail) throws {
|
||||
let boundary = String.makeBoundary()
|
||||
let mixedHeader = String.makeMixedHeader(boundary: boundary)
|
||||
|
||||
try send(mixedHeader)
|
||||
try send(boundary.startLine)
|
||||
|
||||
try sendAlternative(mail.alternative, text: mail.text)
|
||||
try sendAlternative(for: mail)
|
||||
|
||||
try sendAttachments(mail.attachments, boundary: boundary)
|
||||
}
|
||||
|
||||
// If `mail` has an attachment that is an alternative to plain text, sends
|
||||
// that attachment and the plain text.
|
||||
// If `mail` has an attachment that is an alternative to plain text, sends that attachment and the plain text.
|
||||
// Else just sends the plain text.
|
||||
mutating func sendAlternative(_ alternative: Attachment?, text: String) throws {
|
||||
if let alternative = alternative {
|
||||
let boundary = String.createBoundary()
|
||||
let alternativeHeader = String.alternativeHeader(boundary: boundary)
|
||||
func sendAlternative(for mail: Mail) throws {
|
||||
if let alternative = mail.alternative {
|
||||
let boundary = String.makeBoundary()
|
||||
let alternativeHeader = String.makeAlternativeHeader(boundary: boundary)
|
||||
try send(alternativeHeader)
|
||||
|
||||
try send(boundary.startLine)
|
||||
try sendText(text)
|
||||
try sendText(mail.text)
|
||||
|
||||
try send(boundary.startLine)
|
||||
try sendAttachment(alternative)
|
||||
@@ -90,25 +84,25 @@ extension DataSender {
|
||||
return
|
||||
}
|
||||
|
||||
try sendText(text)
|
||||
try sendText(mail.text)
|
||||
}
|
||||
|
||||
// Sends the attachments of a `Mail`.
|
||||
mutating func sendAttachments(_ attachments: [Attachment], boundary: String) throws {
|
||||
for attachement in attachments {
|
||||
func sendAttachments(_ attachments: [Attachment], boundary: String) throws {
|
||||
for attachment in attachments {
|
||||
try send(boundary.startLine)
|
||||
try sendAttachment(attachement)
|
||||
try sendAttachment(attachment)
|
||||
}
|
||||
try send(boundary.endLine)
|
||||
}
|
||||
|
||||
// Send the `attachment`.
|
||||
mutating func sendAttachment(_ attachment: Attachment) throws {
|
||||
func sendAttachment(_ attachment: Attachment) throws {
|
||||
var relatedBoundary = ""
|
||||
|
||||
if attachment.hasRelated {
|
||||
relatedBoundary = String.createBoundary()
|
||||
let relatedHeader = String.relatedHeader(boundary: relatedBoundary)
|
||||
relatedBoundary = String.makeBoundary()
|
||||
let relatedHeader = String.makeRelatedHeader(boundary: relatedBoundary)
|
||||
try send(relatedHeader)
|
||||
try send(relatedBoundary.startLine)
|
||||
}
|
||||
@@ -117,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)
|
||||
@@ -143,7 +136,7 @@ extension DataSender {
|
||||
}
|
||||
#endif
|
||||
|
||||
let encodedData = data.base64EncodedData()
|
||||
let encodedData = data.base64EncodedData(options: .lineLength76Characters)
|
||||
try send(encodedData)
|
||||
|
||||
#if os(macOS)
|
||||
@@ -153,10 +146,9 @@ extension DataSender {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Sends a local file at the given path. File must be base 64 encoded
|
||||
// before sending. Checks the cache first.
|
||||
// Sends a local file at the given path. File must be base 64 encoded before sending. Checks the cache first.
|
||||
// Throws an error if file could not be found.
|
||||
mutating func sendFile(at path: String) throws {
|
||||
func sendFile(at path: String) throws {
|
||||
#if os(macOS)
|
||||
if let data = cache.object(forKey: path as AnyObject) as? Data {
|
||||
return try send(data)
|
||||
@@ -168,10 +160,10 @@ extension DataSender {
|
||||
#endif
|
||||
|
||||
guard let file = FileHandle(forReadingAtPath: path) else {
|
||||
throw SMTPError(.fileNotFound(path: path))
|
||||
throw SMTPError.fileNotFound(path: path)
|
||||
}
|
||||
|
||||
let data = file.readDataToEndOfFile().base64EncodedData()
|
||||
let data = file.readDataToEndOfFile().base64EncodedData(options: .lineLength76Characters)
|
||||
try send(data)
|
||||
file.closeFile()
|
||||
|
||||
@@ -184,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)
|
||||
@@ -195,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
|
||||
}
|
||||
}
|
||||
@@ -209,49 +201,50 @@ 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 {
|
||||
// The SMTP protocol requires unique boundaries between sections of an
|
||||
// email.
|
||||
static func createBoundary() -> String {
|
||||
// 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)"
|
||||
embeddedText += "CONTENT-TRANSFER-ENCODING: 7bit\(CRLF)"
|
||||
embeddedText += "CONTENT-DISPOSITION: inline\(CRLF)"
|
||||
embeddedText += "\(CRLF)\(self)\(CRLF)"
|
||||
return embeddedText
|
||||
}
|
||||
|
||||
// The SMTP protocol requires unique boundaries between sections of an email.
|
||||
static func makeBoundary() -> String {
|
||||
return UUID().uuidString.replacingOccurrences(of: "-", with: "")
|
||||
}
|
||||
|
||||
// Header for a plain text email.
|
||||
static let plainTextHeader = "CONTENT-TYPE: text/plain; charset=utf-8\(CRLF)CONTENT-TRANSFER-ENCODING: 7bit\(CRLF)CONTENT-DISPOSITION: inline\(CRLF)"
|
||||
|
||||
// Header for a mixed type email.
|
||||
static func mixedHeader(boundary: String) -> String {
|
||||
static func makeMixedHeader(boundary: String) -> String {
|
||||
return "CONTENT-TYPE: multipart/mixed; boundary=\"\(boundary)\"\(CRLF)"
|
||||
}
|
||||
|
||||
// Header for an alternative email.
|
||||
static func alternativeHeader(boundary: String) -> String {
|
||||
static func makeAlternativeHeader(boundary: String) -> String {
|
||||
return "CONTENT-TYPE: multipart/alternative; boundary=\"\(boundary)\"\(CRLF)"
|
||||
}
|
||||
|
||||
// Header for an attachment that is related to another attachment.
|
||||
// (Such as an image attachment that can be referenced by a related HTML
|
||||
// attachment)
|
||||
static func relatedHeader(boundary: String) -> String {
|
||||
// Header for an attachment that is related to another attachment. (Such as an image attachment that can be
|
||||
// referenced by a related HTML attachment)
|
||||
static func makeRelatedHeader(boundary: String) -> String {
|
||||
return "CONTENT-TYPE: multipart/related; boundary=\"\(boundary)\"\(CRLF)"
|
||||
}
|
||||
|
||||
// Embed the plain text in a plain text header.
|
||||
func embeddedText() -> String {
|
||||
return "\(String.plainTextHeader)\(CRLF)\(self)\(CRLF)"
|
||||
}
|
||||
|
||||
// Added to a boundary to indicate the beginning of the corresponding
|
||||
// section.
|
||||
// Added to a boundary to indicate the beginning of the corresponding section.
|
||||
var startLine: String {
|
||||
return "--\(self)"
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* 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 an email that can be sent through an `SMTP` instance.
|
||||
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]
|
||||
|
||||
/// message-id https://tools.ietf.org/html/rfc5322#section-3.6.4
|
||||
public var id: String {
|
||||
return "<\(uuid).Swift-SMTP@\(hostname)>"
|
||||
}
|
||||
|
||||
/// 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...])
|
||||
}
|
||||
|
||||
/// Initializes a `Mail` object.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - from: The `User` that the `Mail` will be sent from.
|
||||
/// - to: Array of `User`s to send the `Mail` to.
|
||||
/// - cc: Array of `User`s to cc. Defaults to none.
|
||||
/// - bcc: Array of `User`s to bcc. Defaults to none.
|
||||
/// - subject: Subject of the `Mail`. Defaults to none.
|
||||
/// - text: Text of the `Mail`. Defaults to none.
|
||||
/// - attachments: Array of `Attachment`s for the `Mail`. If the `Mail` has multiple `Attachment`s that are
|
||||
/// alternatives to plain text, the last one will be used as the alternative (all the `Attachments` will still
|
||||
/// be sent). Defaults to none.
|
||||
/// - additionalHeaders: Additional headers for the `Mail`. Header keys are capitalized and duplicate keys will
|
||||
/// overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION,
|
||||
/// CONTENT-TRANSFER-ENCODING.
|
||||
public init(from: User,
|
||||
to: [User],
|
||||
cc: [User] = [],
|
||||
bcc: [User] = [],
|
||||
subject: String = "",
|
||||
text: String = "",
|
||||
attachments: [Attachment] = [],
|
||||
additionalHeaders: [String: String] = [:]) {
|
||||
self.from = from
|
||||
self.to = to
|
||||
self.cc = cc
|
||||
self.bcc = bcc
|
||||
self.subject = subject
|
||||
self.text = text
|
||||
|
||||
let (alternative, attachments) = Mail.getAlternative(attachments)
|
||||
self.alternative = alternative
|
||||
self.attachments = attachments
|
||||
|
||||
self.additionalHeaders = additionalHeaders
|
||||
}
|
||||
|
||||
private static func getAlternative(_ attachments: [Attachment]) -> (Attachment?, [Attachment]) {
|
||||
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)
|
||||
}
|
||||
|
||||
private var headersDictionary: [String: String] {
|
||||
var dictionary = [String: String]()
|
||||
dictionary["MESSAGE-ID"] = id
|
||||
dictionary["DATE"] = Date().smtpFormatted
|
||||
dictionary["FROM"] = from.mime
|
||||
dictionary["TO"] = to.map { $0.mime }.joined(separator: ", ")
|
||||
|
||||
if !cc.isEmpty {
|
||||
dictionary["CC"] = cc.map { $0.mime }.joined(separator: ", ")
|
||||
}
|
||||
|
||||
dictionary["SUBJECT"] = subject.mimeEncoded ?? ""
|
||||
dictionary["MIME-VERSION"] = "1.0 (Swift-SMTP)"
|
||||
|
||||
for (key, value) in additionalHeaders {
|
||||
let keyUppercased = key.uppercased()
|
||||
if keyUppercased != "CONTENT-TYPE" &&
|
||||
keyUppercased != "CONTENT-DISPOSITION" &&
|
||||
keyUppercased != "CONTENT-TRANSFER-ENCODING" {
|
||||
dictionary[keyUppercased] = value
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary
|
||||
}
|
||||
|
||||
var headersString: String {
|
||||
return headersDictionary.map { (key, value) in
|
||||
return "\(key): \(value)"
|
||||
}.joined(separator: CRLF)
|
||||
}
|
||||
|
||||
var hasAttachment: Bool {
|
||||
return !attachments.isEmpty || alternative != nil
|
||||
}
|
||||
}
|
||||
|
||||
extension Mail {
|
||||
/// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension DateFormatter {
|
||||
static let smtpDateFormatter: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "EEE, d MMM yyyy HH:mm:ss ZZZ"
|
||||
return formatter
|
||||
}()
|
||||
}
|
||||
|
||||
extension Date {
|
||||
var smtpFormatted: String {
|
||||
return DateFormatter.smtpDateFormatter.string(from: self)
|
||||
}
|
||||
}
|
||||
@@ -20,24 +20,28 @@ import Foundation
|
||||
import Dispatch
|
||||
#endif
|
||||
|
||||
/// (`Mail`, `Error`) callback after each `Mail` is sent. `Mail` is the mail sent and `Error` is the error if it failed.
|
||||
public typealias Progress = ((Mail, Error?) -> Void)?
|
||||
|
||||
/// ([`Mail`], [(`Mail`, `Error`)]) callback after all `Mail`s have been attempted. [`Mail`] is an array of successfully
|
||||
/// sent `Mail`s. [(`Mail`, `Error`)] is an array of failed `Mail`s and their corresponding `Error`s.
|
||||
public typealias Completion = (([Mail], [(Mail, Error)]) -> Void)?
|
||||
|
||||
class Sender {
|
||||
fileprivate var socket: SMTPSocket
|
||||
fileprivate var pending: [Mail]
|
||||
fileprivate var progress: Progress
|
||||
fileprivate var completion: Completion
|
||||
fileprivate var sent = [Mail]()
|
||||
fileprivate var failed = [(Mail, Error)]()
|
||||
var dataSender: DataSender
|
||||
class MailSender {
|
||||
private var socket: SMTPSocket
|
||||
private var mailsToSend: [Mail]
|
||||
private var progress: Progress
|
||||
private var completion: Completion
|
||||
private var sent = [Mail]()
|
||||
private var failed = [(Mail, Error)]()
|
||||
private var dataSender: DataSender
|
||||
|
||||
init(socket: SMTPSocket,
|
||||
pending: [Mail],
|
||||
mailsToSend: [Mail],
|
||||
progress: Progress,
|
||||
completion: Completion) {
|
||||
self.socket = socket
|
||||
self.pending = pending
|
||||
self.mailsToSend = mailsToSend
|
||||
self.progress = progress
|
||||
self.completion = completion
|
||||
dataSender = DataSender(socket: socket)
|
||||
@@ -50,32 +54,28 @@ class Sender {
|
||||
}
|
||||
}
|
||||
|
||||
private extension Sender {
|
||||
private extension MailSender {
|
||||
func sendNext() {
|
||||
if pending.isEmpty {
|
||||
if mailsToSend.isEmpty {
|
||||
completion?(sent, failed)
|
||||
progress = nil
|
||||
completion = nil
|
||||
try? quit()
|
||||
return
|
||||
}
|
||||
|
||||
let mail = pending.removeFirst()
|
||||
|
||||
let mail = mailsToSend.removeFirst()
|
||||
do {
|
||||
try send(mail)
|
||||
if completion != nil {
|
||||
sent.append(mail)
|
||||
}
|
||||
progress?(mail, nil)
|
||||
|
||||
} catch {
|
||||
if completion != nil {
|
||||
failed.append((mail, error))
|
||||
}
|
||||
progress?(mail, error)
|
||||
}
|
||||
|
||||
DispatchQueue.global().async {
|
||||
self.sendNext()
|
||||
}
|
||||
@@ -85,11 +85,9 @@ private extension Sender {
|
||||
try socket.send(.quit)
|
||||
socket.close()
|
||||
}
|
||||
}
|
||||
|
||||
private extension Sender {
|
||||
func send(_ mail: Mail) throws {
|
||||
let recipientEmails = getRecipientEmails(from: mail)
|
||||
let recipientEmails = try getRecipientEmails(from: mail)
|
||||
try validateEmails(recipientEmails)
|
||||
try sendMail(mail.from.email)
|
||||
try sendTo(recipientEmails)
|
||||
@@ -98,53 +96,53 @@ private extension Sender {
|
||||
try dataEnd()
|
||||
}
|
||||
|
||||
private func getRecipientEmails(from mail: Mail) -> [String] {
|
||||
func getRecipientEmails(from mail: Mail) throws -> [String] {
|
||||
var recipientEmails = mail.to.map { $0.email }
|
||||
recipientEmails += mail.cc.map { $0.email }
|
||||
recipientEmails += mail.bcc.map { $0.email }
|
||||
|
||||
guard !recipientEmails.isEmpty else {
|
||||
throw SMTPError.noRecipients
|
||||
}
|
||||
|
||||
return recipientEmails
|
||||
}
|
||||
|
||||
private func validateEmails(_ emails: [String]) throws {
|
||||
func validateEmails(_ emails: [String]) throws {
|
||||
for email in emails where try !email.isValidEmail() {
|
||||
throw SMTPError(.invalidEmail(email: email))
|
||||
throw SMTPError.invalidEmail(email: email)
|
||||
}
|
||||
}
|
||||
|
||||
private func sendMail(_ from: String) throws {
|
||||
func sendMail(_ from: String) throws {
|
||||
try socket.send(.mail(from))
|
||||
}
|
||||
|
||||
private func sendTo(_ emails: [String]) throws {
|
||||
func sendTo(_ emails: [String]) throws {
|
||||
for email in emails {
|
||||
try socket.send(.rcpt(email))
|
||||
}
|
||||
}
|
||||
|
||||
private func data() throws {
|
||||
func data() throws {
|
||||
try socket.send(.data)
|
||||
}
|
||||
|
||||
private func dataEnd() throws {
|
||||
func dataEnd() throws {
|
||||
try socket.send(.dataEnd)
|
||||
}
|
||||
}
|
||||
|
||||
#if os(Linux) && !swift(>=3.1)
|
||||
private typealias NSRegularExpression = RegularExpression
|
||||
#endif
|
||||
|
||||
private extension NSRegularExpression {
|
||||
static let emailRegex = try? NSRegularExpression(pattern: "^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}", options: [])
|
||||
static let emailRegex = try? NSRegularExpression(pattern: "^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}")
|
||||
}
|
||||
|
||||
extension String {
|
||||
private extension String {
|
||||
func isValidEmail() throws -> Bool {
|
||||
guard let emailRegex = NSRegularExpression.emailRegex else {
|
||||
throw SMTPError(.createEmailRegexFailed)
|
||||
throw SMTPError.createEmailRegexFailed
|
||||
}
|
||||
|
||||
let range = NSRange(location: 0, length: self.characters.count)
|
||||
let range = NSRange(location: 0, length: count)
|
||||
return !emailRegex.matches(in: self, options: [], range: range).isEmpty
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Used to connect to an SMTP server and send emails.
|
||||
public struct SMTP {
|
||||
private let hostname: String
|
||||
private let email: String
|
||||
private let password: String
|
||||
private let port: Int32
|
||||
private let tlsMode: TLSMode
|
||||
private let tlsConfiguration: TLSConfiguration?
|
||||
private let authMethods: [String: AuthMethod]
|
||||
private let domainName: String
|
||||
private let timeout: UInt
|
||||
|
||||
/// TLSMode enum for what form of connection security to enforce.
|
||||
public enum TLSMode {
|
||||
/// Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.
|
||||
case normal
|
||||
|
||||
/// Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.
|
||||
case ignoreTLS
|
||||
|
||||
/// Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.
|
||||
case requireTLS
|
||||
|
||||
/// Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.
|
||||
case requireSTARTTLS
|
||||
}
|
||||
|
||||
/// Initializes an `SMTP` instance.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - hostname: Hostname of the SMTP server to connect to, i.e. `smtp.example.com`.
|
||||
/// - email: Username to log in to server.
|
||||
/// - password: Password to log in to server, or access token if using XOAUTH2 authorization method.
|
||||
/// - port: Port to connect to the server on. Defaults to `465`.
|
||||
/// - tlsMode: TLSMode `enum` indicating what form of connection security to use.
|
||||
/// - tlsConfiguration: `TLSConfiguration` used to connect with TLS. If nil, a configuration with no backing
|
||||
/// certificates is used. See `TLSConfiguration` for other configuration options.
|
||||
/// - authMethods: `AuthMethod`s to use to log in to the server. If blank, tries all supported methods.
|
||||
/// - domainName: Client domain name used when communicating with the server. Defaults to `localhost`.
|
||||
/// - timeout: How long to try connecting to the server to before returning an error. Defaults to `10` seconds.
|
||||
///
|
||||
/// - Note:
|
||||
/// - You may need to enable access for less secure apps for your account on the SMTP server.
|
||||
/// - Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
|
||||
/// IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.
|
||||
public init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Int32 = 587,
|
||||
tlsMode: TLSMode = .requireSTARTTLS,
|
||||
tlsConfiguration: TLSConfiguration? = nil,
|
||||
authMethods: [AuthMethod] = [],
|
||||
domainName: String = "localhost",
|
||||
timeout: UInt = 10) {
|
||||
self.hostname = hostname
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.port = port
|
||||
self.tlsMode = tlsMode
|
||||
self.tlsConfiguration = tlsConfiguration
|
||||
|
||||
let _authMethods = !authMethods.isEmpty ? authMethods : [
|
||||
AuthMethod.cramMD5,
|
||||
AuthMethod.login,
|
||||
AuthMethod.plain,
|
||||
AuthMethod.xoauth2
|
||||
]
|
||||
var authMethodsDictionary = [String: AuthMethod]()
|
||||
_authMethods.forEach { authMethod in
|
||||
authMethodsDictionary[authMethod.rawValue] = authMethod
|
||||
}
|
||||
self.authMethods = authMethodsDictionary
|
||||
|
||||
self.domainName = domainName
|
||||
self.timeout = timeout
|
||||
}
|
||||
|
||||
/// Send an email.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - mail: `Mail` object to send.
|
||||
/// - completion: Callback when sending finishes. `Error` is nil on success. (optional)
|
||||
public func send(_ mail: Mail, completion: ((Error?) -> Void)? = nil) {
|
||||
send([mail], completion: { (_, failed) in
|
||||
if let error = failed.first?.1 {
|
||||
completion?(error)
|
||||
} else {
|
||||
completion?(nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Send multiple emails.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - mails: Array of `Mail`s to send.
|
||||
/// - progress: (`Mail`, `Error`) callback after each `Mail` is sent. `Mail` is the mail sent and `Error` is
|
||||
/// the error if it failed. (optional)
|
||||
/// - completion: ([`Mail`], [(`Mail`, `Error`)]) callback after all `Mail`s have been attempted. [`Mail`] is an
|
||||
/// array of successfully sent `Mail`s. [(`Mail`, `Error`)] is an array of failed `Mail`s and their
|
||||
/// corresponding `Error`s. (optional)
|
||||
///
|
||||
/// - Note:
|
||||
/// - Each call to `send` will first log in to your server, attempt to send the mails, then closes the
|
||||
/// connection. Pass in an array of `Mail`s to send them all in one session.
|
||||
/// - If any of the email addresses in a `Mail`'s `to`, `cc`, or `bcc` are invalid, the entire mail will not
|
||||
/// send and return an `SMTPError`.
|
||||
/// - If an individual `Mail` fails while sending an array of `Mail`s, the whole sending process will continue
|
||||
/// until all pending `Mail`s are attempted.
|
||||
/// - Each call to `send` queues it's `Mail`s and sends them one by one. To send `Mail`s concurrently, send them
|
||||
/// in separate calls to `send`.
|
||||
public func send(_ mails: [Mail],
|
||||
progress: Progress = nil,
|
||||
completion: Completion = nil) {
|
||||
if mails.isEmpty {
|
||||
completion?([], [])
|
||||
return
|
||||
}
|
||||
do {
|
||||
let socket = try SMTPSocket(
|
||||
hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
tlsMode: tlsMode,
|
||||
tlsConfiguration: tlsConfiguration,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
timeout: timeout
|
||||
)
|
||||
MailSender(
|
||||
socket: socket,
|
||||
mailsToSend: mails,
|
||||
progress: progress,
|
||||
completion: completion).send()
|
||||
} catch {
|
||||
completion?([], mails.map { ($0, error) })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,22 +29,14 @@ public enum SMTPError: Error, CustomStringConvertible {
|
||||
// DataSender
|
||||
/// File not found at path while trying to send file `Attachment`.
|
||||
case fileNotFound(path: String)
|
||||
|
||||
// Login
|
||||
/// Could not connect to server within specified timeout. Ensure your
|
||||
/// server can connect through `Port` 587 or specify which `Port` to connect
|
||||
/// on. Some SMTP servers may require a longer timeout.
|
||||
case couldNotConnectToServer(server: String, timeout: Int)
|
||||
|
||||
/// 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.
|
||||
case noRecipients
|
||||
|
||||
/// Failed to create RegularExpression that can check if an email is valid.
|
||||
case createEmailRegexFailed
|
||||
|
||||
@@ -58,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 {
|
||||
@@ -65,18 +60,18 @@ public enum SMTPError: Error, CustomStringConvertible {
|
||||
case .base64DecodeFail(let s): return "Error decoding string: \(s)."
|
||||
case .md5HashChallengeFail: return "Hashing server challenge with MD5 algorithm failed."
|
||||
case .fileNotFound(let p): return "File not found at path while trying to send file `Attachment`: \(p)."
|
||||
case .couldNotConnectToServer(let s, let t): return "Could not connect to server (\(s)) within specified timeout (\(t) seconds). Ensure your server can connect through port 587 or specify which port to connect on. Some SMTP servers may require a longer timeout."
|
||||
case .noSupportedAuthMethods(let hostname): return "The preferred authorization methods could not be found on \(hostname). Connecting with SSL may be required."
|
||||
case .noAccessToken: return "Attempted to login using XOAUTH2 but SMTP instance was initialized without an access token."
|
||||
case .noAuthMethodsOrRequiresTLS(let hostname): return "The preferred authorization methods could not be found on \(hostname), or your server is sending back a STARTTLS command and requires a connection upgrade."
|
||||
case .noRecipients: return "An email requires at least one recipient."
|
||||
case .createEmailRegexFailed: return "Failed to create RegularExpression that can check if an email is valid."
|
||||
case .badResponse(let command, let response): return "Bad response received for command. command: (\(command)), response: \(response)"
|
||||
case .convertDataUTF8Fail(let buf): return "Error converting Data read from socket to a String: \(buf)."
|
||||
case .invalidEmail(let email): return "Invalid email provided for User: \(email)."
|
||||
case .requiredSTARTTLS: return "STARTTLS was required but the server did not issue a STARTTLS command."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init(_ error: SMTPError) {
|
||||
self = error
|
||||
Log.error(self.description)
|
||||
Log.error(description)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2018
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
import Socket
|
||||
import LoggerAPI
|
||||
|
||||
struct SMTPSocket {
|
||||
private let socket: Socket
|
||||
|
||||
init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Int32,
|
||||
tlsMode: SMTP.TLSMode,
|
||||
tlsConfiguration: TLSConfiguration?,
|
||||
authMethods: [String: AuthMethod],
|
||||
domainName: String,
|
||||
timeout: UInt) throws {
|
||||
socket = try Socket.create()
|
||||
if tlsMode == .requireTLS {
|
||||
if let tlsConfiguration = tlsConfiguration {
|
||||
socket.delegate = try tlsConfiguration.makeSSLService()
|
||||
} else {
|
||||
socket.delegate = try TLSConfiguration().makeSSLService()
|
||||
}
|
||||
}
|
||||
try socket.connect(to: hostname, port: port, timeout: timeout * 1000)
|
||||
try parseResponses(readFromSocket(), command: .connect)
|
||||
var serverOptions = try getServerOptions(domainName: domainName)
|
||||
if tlsMode == .requireSTARTTLS || tlsMode == .normal {
|
||||
if try doStarttls(serverOptions: serverOptions, tlsConfiguration: tlsConfiguration) {
|
||||
serverOptions = try getServerOptions(domainName: domainName)
|
||||
} else if tlsMode == .requireSTARTTLS {
|
||||
throw SMTPError.requiredSTARTTLS
|
||||
}
|
||||
}
|
||||
let authMethod = try getAuthMethod(authMethods: authMethods, serverOptions: serverOptions, hostname: hostname)
|
||||
try login(authMethod: authMethod, email: email, password: password)
|
||||
}
|
||||
|
||||
func write(_ text: String) throws {
|
||||
_ = try socket.write(from: text + CRLF)
|
||||
Log.debug(text)
|
||||
}
|
||||
|
||||
func write(_ data: Data) throws {
|
||||
_ = try socket.write(from: data)
|
||||
Log.debug("(sending data)")
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func send(_ command: Command) throws -> [Response] {
|
||||
try write(command.text)
|
||||
return try parseResponses(readFromSocket(), command: command)
|
||||
}
|
||||
|
||||
func close() {
|
||||
socket.close()
|
||||
}
|
||||
}
|
||||
|
||||
private extension SMTPSocket {
|
||||
func readFromSocket() throws -> String {
|
||||
var buf = Data()
|
||||
_ = try socket.read(into: &buf)
|
||||
guard let responses = String(data: buf, encoding: .utf8) else {
|
||||
throw SMTPError.convertDataUTF8Fail(data: buf)
|
||||
}
|
||||
Log.debug(responses)
|
||||
return responses
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func parseResponses(_ responses: String, command: Command) throws -> [Response] {
|
||||
let responsesArray = responses.components(separatedBy: CRLF)
|
||||
guard !responsesArray.isEmpty else {
|
||||
throw SMTPError.badResponse(command: command.text, response: responses)
|
||||
}
|
||||
#if swift(>=4.1)
|
||||
return try responsesArray.compactMap { response in
|
||||
guard response != "" else {
|
||||
return nil
|
||||
}
|
||||
return Response(
|
||||
code: try getResponseCode(response, command: command),
|
||||
message: getResponseMessage(response),
|
||||
response: response
|
||||
)
|
||||
}
|
||||
#else
|
||||
return try responsesArray.flatMap { response in
|
||||
guard response != "" else {
|
||||
return nil
|
||||
}
|
||||
return Response(
|
||||
code: try getResponseCode(response, command: command),
|
||||
message: getResponseMessage(response),
|
||||
response: response
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
|
||||
guard response.count > 3 else {
|
||||
throw SMTPError.badResponse(command: command.text, response: response)
|
||||
}
|
||||
guard let code = Int(response[..<response.index(response.startIndex, offsetBy: 3)]) else {
|
||||
throw SMTPError.badResponse(command: command.text, response: response)
|
||||
}
|
||||
guard
|
||||
response.count > 2,
|
||||
command.expectedResponseCodes.map({ $0.rawValue }).contains(code) else {
|
||||
throw SMTPError.badResponse(command: command.text, response: response)
|
||||
}
|
||||
return ResponseCode(code)
|
||||
}
|
||||
|
||||
func getResponseMessage(_ response: String) -> String {
|
||||
guard response.count > 3 else {
|
||||
return ""
|
||||
}
|
||||
return String(response[response.index(response.startIndex, offsetBy: 4)...])
|
||||
}
|
||||
}
|
||||
|
||||
private extension SMTPSocket {
|
||||
func getServerOptions(domainName: String) throws -> [Response] {
|
||||
do {
|
||||
return try send(.ehlo(domainName))
|
||||
} catch {
|
||||
return try send(.helo(domainName))
|
||||
}
|
||||
}
|
||||
|
||||
func getAuthMethod(authMethods: [String: AuthMethod], serverOptions: [Response], hostname: String) throws -> AuthMethod {
|
||||
for option in serverOptions {
|
||||
let components = option.message.components(separatedBy: " ")
|
||||
if components.first == "AUTH" {
|
||||
let _authMethods = components.dropFirst()
|
||||
for authMethod in _authMethods {
|
||||
if let matchingAuthMethod = authMethods[authMethod] {
|
||||
return matchingAuthMethod
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw SMTPError.noAuthMethodsOrRequiresTLS(hostname: hostname)
|
||||
}
|
||||
|
||||
func doStarttls(serverOptions: [Response], tlsConfiguration: TLSConfiguration?) throws -> Bool {
|
||||
for option in serverOptions {
|
||||
if option.message == "STARTTLS" {
|
||||
try starttls(tlsConfiguration: tlsConfiguration)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func starttls(tlsConfiguration: TLSConfiguration?) throws {
|
||||
try send(.starttls)
|
||||
// Upgrade the socket to SSL/TLS
|
||||
if let tlsConfiguration = tlsConfiguration {
|
||||
socket.delegate = try tlsConfiguration.makeSSLService()
|
||||
} else {
|
||||
socket.delegate = try TLSConfiguration().makeSSLService()
|
||||
}
|
||||
try socket.delegate?.initialize(asServer: false)
|
||||
try socket.delegate?.onConnect(socket: socket)
|
||||
}
|
||||
|
||||
func login(authMethod: AuthMethod, email: String, password: String) throws {
|
||||
switch authMethod {
|
||||
case .cramMD5:
|
||||
try loginCramMD5(email: email, password: password)
|
||||
case .login:
|
||||
try loginLogin(email: email, password: password)
|
||||
case .plain:
|
||||
try loginPlain(email: email, password: password)
|
||||
case .xoauth2:
|
||||
try loginXOAuth2(email: email, accessToken: password)
|
||||
}
|
||||
}
|
||||
|
||||
func loginCramMD5(email: String, password: String) throws {
|
||||
let challenge = try auth(authMethod: .cramMD5, credentials: nil).message
|
||||
try authPassword(try AuthEncoder.cramMD5(challenge: challenge, user: email, password: password))
|
||||
}
|
||||
|
||||
func loginLogin(email: String, password: String) throws {
|
||||
try auth(authMethod: .login, credentials: nil)
|
||||
let credentials = AuthEncoder.login(user: email, password: password)
|
||||
try authUser(credentials.encodedUser)
|
||||
try authPassword(credentials.encodedPassword)
|
||||
}
|
||||
|
||||
func loginPlain(email: String, password: String) throws {
|
||||
try auth(
|
||||
authMethod: .plain,
|
||||
credentials: AuthEncoder.plain(user: email, password: password)
|
||||
)
|
||||
}
|
||||
|
||||
func loginXOAuth2(email: String, accessToken: String) throws {
|
||||
try auth(authMethod: .xoauth2, credentials: AuthEncoder.xoauth2(user: email, accessToken: accessToken))
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func auth(authMethod: AuthMethod, credentials: String?) throws -> Response {
|
||||
let responses = try send(.auth(authMethod, credentials))
|
||||
guard let response = responses.first else {
|
||||
throw SMTPError.badResponse(command: "AUTH", response: responses.description)
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
func authUser(_ user: String) throws {
|
||||
try send(.authUser(user))
|
||||
}
|
||||
|
||||
func authPassword(_ password: String) throws {
|
||||
try send(.authPassword(password))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
import SSLService
|
||||
|
||||
/// Configuration for connecting with TLS. For more info, see https://github.com/Kitura/BlueSSLService.
|
||||
public struct TLSConfiguration {
|
||||
private let configuration: SSLService.Configuration
|
||||
|
||||
///
|
||||
/// Initialize a configuration with no backing certificates.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
/// - clientAllowsSelfSignedCertificates:
|
||||
/// `true` to accept self-signed certificates from a server. `false` otherwise.
|
||||
public init(withCipherSuite cipherSuite: String? = nil,
|
||||
clientAllowsSelfSignedCertificates: Bool = false) {
|
||||
configuration = SSLService.Configuration(
|
||||
withCipherSuite: cipherSuite,
|
||||
clientAllowsSelfSignedCertificates: clientAllowsSelfSignedCertificates
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// Initialize a configuration using a `CA Certificate` file.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - caCertificateFilePath: Path to the PEM formatted CA certificate file.
|
||||
/// - certificateFilePath: Path to the PEM formatted certificate file.
|
||||
/// - keyFilePath: Path to the PEM formatted key file. If nil, `certificateFilePath` will be used.
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withCACertificateFilePath caCertificateFilePath: String?,
|
||||
usingCertificateFile certificateFilePath: String?,
|
||||
withKeyFile keyFilePath: String? = nil,
|
||||
usingSelfSignedCerts selfSigned: Bool = true,
|
||||
cipherSuite: String? = nil) {
|
||||
configuration = SSLService.Configuration(
|
||||
withCACertificateFilePath: caCertificateFilePath,
|
||||
usingCertificateFile: certificateFilePath,
|
||||
withKeyFile: keyFilePath,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
cipherSuite: cipherSuite
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// Initialize a configuration using a `CA Certificate` directory.
|
||||
///
|
||||
/// *Note:* `caCertificateDirPath` - All certificates in the specified directory **must** be hashed using the `OpenSSL Certificate Tool`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - caCertificateDirPath: Path to a directory containing CA certificates. *(see note above)*
|
||||
/// - certificateFilePath: Path to the PEM formatted certificate file. If nil, `certificateFilePath` will be used.
|
||||
/// - keyFilePath: Path to the PEM formatted key file (optional). If nil, `certificateFilePath` is used.
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withCACertificateDirectory caCertificateDirPath: String?,
|
||||
usingCertificateFile certificateFilePath: String?,
|
||||
withKeyFile keyFilePath: String? = nil,
|
||||
usingSelfSignedCerts selfSigned: Bool = true,
|
||||
cipherSuite: String? = nil) {
|
||||
configuration = SSLService.Configuration(
|
||||
withCACertificateDirectory: caCertificateDirPath,
|
||||
usingCertificateFile: certificateFilePath,
|
||||
withKeyFile: keyFilePath,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
cipherSuite: cipherSuite
|
||||
)
|
||||
}
|
||||
|
||||
///
|
||||
/// Initialize a configuration using a `Certificate Chain File`.
|
||||
///
|
||||
/// *Note:* If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject's certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - chainFilePath: Path to the certificate chain file (optional). *(see note above)*
|
||||
/// - password: Password for the chain file (optional). If using self-signed certs, a password is required.
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - clientAllowsSelfSignedCertificates: True if, as a client, connections to self-signed servers are allowed
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withChainFilePath chainFilePath: String?,
|
||||
withPassword password: String? = nil,
|
||||
usingSelfSignedCerts selfSigned: Bool = true,
|
||||
clientAllowsSelfSignedCertificates: Bool = false,
|
||||
cipherSuite: String? = nil) {
|
||||
configuration = SSLService.Configuration(
|
||||
withChainFilePath: chainFilePath,
|
||||
withPassword: password,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
clientAllowsSelfSignedCertificates:
|
||||
clientAllowsSelfSignedCertificates,
|
||||
cipherSuite: cipherSuite
|
||||
)
|
||||
}
|
||||
|
||||
#if os(Linux)
|
||||
///
|
||||
/// Initialize a configuration using a `PEM formatted certificate in String form`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - certificateString: PEM formatted certificate in String form.
|
||||
/// - selfSigned: True if certs are `self-signed`, false otherwise. Defaults to true.
|
||||
/// - cipherSuite: Optional String containing the cipher suite to use.
|
||||
public init(withPEMCertificateString certificateString: String,
|
||||
usingSelfSignedCerts selfSigned: Bool = true,
|
||||
cipherSuite: String? = nil) {
|
||||
configuration = SSLService.Configuration(
|
||||
withPEMCertificateString: certificateString,
|
||||
usingSelfSignedCerts: selfSigned,
|
||||
cipherSuite: cipherSuite
|
||||
)
|
||||
}
|
||||
#endif
|
||||
|
||||
func makeSSLService() throws -> SSLService? {
|
||||
return try SSLService(usingConfiguration: configuration)
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Represents a sender or receiver of an email.
|
||||
public struct User {
|
||||
fileprivate let name: String?
|
||||
let email: String
|
||||
|
||||
/// Initializes a `User`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - name: Display name for the user. (optional)
|
||||
/// - email: Email address for the user.
|
||||
public init(name: String? = nil, email: String) {
|
||||
self.name = name
|
||||
self.email = email
|
||||
}
|
||||
}
|
||||
|
||||
extension User {
|
||||
var mime: String {
|
||||
if let name = name, let nameEncoded = name.mimeEncoded {
|
||||
return "\(nameEncoded) <\(email)>"
|
||||
} else {
|
||||
return email
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,17 @@ import Glibc
|
||||
srand(UInt32(time(nil)))
|
||||
|
||||
// http://stackoverflow.com/questions/24026510/how-do-i-shuffle-an-array-in-swift
|
||||
extension MutableCollection where Indices.Iterator.Element == Index {
|
||||
|
||||
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))
|
||||
let d: Int = numericCast(random() % numericCast(unshuffledCount))
|
||||
guard d != 0 else { continue }
|
||||
let i = index(firstUnshuffled, offsetBy: d)
|
||||
swap(&self[firstUnshuffled], &self[i])
|
||||
self.swapAt(firstUnshuffled, i)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,8 +48,7 @@ XCTMain([
|
||||
testCase(TestAttachment.allTests.shuffled()),
|
||||
testCase(TestAuthEncoder.allTests.shuffled()),
|
||||
testCase(TestDataSender.allTests.shuffled()),
|
||||
testCase(TestLogin.allTests.shuffled()),
|
||||
testCase(TestMailSender.allTests.shuffled()),
|
||||
testCase(TestMiscellaneous.allTests.shuffled()),
|
||||
testCase(TestSender.allTests.shuffled()),
|
||||
testCase(TestSMTPSocket.allTests.shuffled())
|
||||
].shuffled())
|
||||
testCase(TestSMTPSocket.allTests.shuffled()),
|
||||
testCase(TestTLSMode.allTests.shuffled())].shuffled())
|
||||
|
||||
@@ -21,110 +21,125 @@ import Foundation
|
||||
import Glibc
|
||||
#endif
|
||||
|
||||
let testDuration: Double = 20
|
||||
let testDuration: Double = 15
|
||||
|
||||
// Fill in your own SMTP login info for local testing
|
||||
let localHostname: String? = nil
|
||||
let localEmail: String? = nil
|
||||
let localPassword: String? = nil
|
||||
let localPort: SwiftSMTP.Port? = nil
|
||||
let localSecure: Bool? = nil
|
||||
let localAuthMethods: [AuthMethod]? = nil
|
||||
|
||||
let hostname: String = {
|
||||
if let localHostname = localHostname {
|
||||
return localHostname
|
||||
} else {
|
||||
return "smtp.gmail.com"
|
||||
}
|
||||
}()
|
||||
// 📧📧📧 Fill in your own SMTP login info for local testing
|
||||
// ⚠️⚠️⚠️ DO NOT CHECK IN YOUR EMAIL CREDENTALS!!!
|
||||
let hostname = "mail.kitura.dev"
|
||||
let myEmail: String? = nil
|
||||
let myPassword: String? = nil
|
||||
let portTLS: Int32 = 465
|
||||
let portPlain: Int32 = 2525
|
||||
let authMethods: [String: AuthMethod] = [
|
||||
AuthMethod.cramMD5.rawValue: .cramMD5,
|
||||
AuthMethod.login.rawValue: .login,
|
||||
AuthMethod.plain.rawValue: .plain
|
||||
]
|
||||
let domainName = "localhost"
|
||||
let timeout: UInt = 10
|
||||
|
||||
let email: String = {
|
||||
if let localEmail = localEmail {
|
||||
return localEmail
|
||||
if let email = myEmail {
|
||||
return email
|
||||
}
|
||||
let url = credentialsDir.appendingPathComponent("/email.txt")
|
||||
guard
|
||||
let data = try? Data(contentsOf: url),
|
||||
let email = String(data: data, encoding: .utf8)
|
||||
else {
|
||||
fatalError("Could not get email to login for tests.")
|
||||
guard let email = ProcessInfo.processInfo.environment["EMAIL"] else {
|
||||
fatalError("Please provide email credentials for local testing.")
|
||||
}
|
||||
return email.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines)
|
||||
return email
|
||||
}()
|
||||
|
||||
let password: String = {
|
||||
if let localPassword = localPassword {
|
||||
return localPassword
|
||||
if let password = myPassword {
|
||||
return password
|
||||
}
|
||||
let url = credentialsDir.appendingPathComponent("/password.txt")
|
||||
guard
|
||||
let data = try? Data(contentsOf: url),
|
||||
let password = String(data: data, encoding: .utf8)
|
||||
else {
|
||||
fatalError("Could not get password to login for tests.")
|
||||
guard let password = ProcessInfo.processInfo.environment["PASSWORD"] else {
|
||||
fatalError("Please provide email credentials for local testing.")
|
||||
}
|
||||
return password.trimmingCharacters(in: NSCharacterSet.whitespacesAndNewlines)
|
||||
return password
|
||||
}()
|
||||
|
||||
let port: SwiftSMTP.Port = {
|
||||
if let localPort = localPort {
|
||||
return localPort
|
||||
let senderEmailDomain: String = {
|
||||
#if swift(>=5)
|
||||
if let atIndex = email.firstIndex(of: "@") {
|
||||
let domainStart = email.index(after: atIndex)
|
||||
return String(email[domainStart...])
|
||||
} else {
|
||||
return Ports.tls.rawValue
|
||||
return "gmail.com"
|
||||
}
|
||||
}()
|
||||
|
||||
let secure: Bool = {
|
||||
if let localSecure = localSecure {
|
||||
return localSecure
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}()
|
||||
|
||||
let authMethods: [AuthMethod] = {
|
||||
if let localAuthMethods = localAuthMethods {
|
||||
return localAuthMethods
|
||||
} else {
|
||||
return [.cramMD5, .login, .plain]
|
||||
}
|
||||
}()
|
||||
|
||||
let domainName = "localhost"
|
||||
let timeout = 10
|
||||
|
||||
#if os(Linux)
|
||||
let cert = testsDir + "/cert.pem"
|
||||
let key = testsDir + "/key.pem"
|
||||
let ssl = SSL(withCACertificateDirectory: nil, usingCertificateFile: cert, withKeyFile: key)
|
||||
#else
|
||||
let cert = testsDir + "/cert.pfx"
|
||||
let certPassword = "kitura"
|
||||
let ssl = SSL(withChainFilePath: cert, withPassword: certPassword)
|
||||
if let atIndex = email.index(of: "@") {
|
||||
let domainStart = email.index(after: atIndex)
|
||||
return String(email[domainStart...])
|
||||
} else {
|
||||
return "gmail.com"
|
||||
}
|
||||
#endif
|
||||
|
||||
let smtp = SMTP(hostname: hostname, email: email, password: password, ssl: ssl)
|
||||
let from = User(name: "Dr. Light", email: email)
|
||||
let to = User(name: "Megaman", email: email)
|
||||
let to2 = User(name: "Roll", email: email)
|
||||
let text = "Humans and robots living together in harmony and equality. That was my ultimate wish."
|
||||
let html = "<html><img src=\"http://vignette2.wikia.nocookie.net/megaman/images/4/40/StH250RobotMasters.jpg/revision/latest?cb=20130711161323\"/></html>"
|
||||
let imgFilePath = testsDir + "/x.png"
|
||||
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
|
||||
|
||||
let credentialsDir: URL = {
|
||||
return URL(fileURLWithPath: #file).appendingPathComponent("../../../Kitura-TestingCredentials/Swift-SMTP").standardized
|
||||
}()
|
||||
|
||||
let testsDir: String = {
|
||||
return URL(fileURLWithPath: #file).appendingPathComponent("..").standardized.path
|
||||
}()
|
||||
|
||||
#if os(Linux)
|
||||
let cert = testsDir + "/cert.pem"
|
||||
let key = testsDir + "/key.pem"
|
||||
let tlsConfiguration = TLSConfiguration(withCACertificateDirectory: nil, usingCertificateFile: cert, withKeyFile: key)
|
||||
#else
|
||||
let cert = testsDir + "/cert.pfx"
|
||||
let certPassword = "kitura"
|
||||
let tlsConfiguration = TLSConfiguration(withChainFilePath: cert, withPassword: certPassword)
|
||||
#endif
|
||||
|
||||
let smtp = SMTP(hostname: hostname, email: email, password: password)
|
||||
let from = Mail.User(name: "Dr. Light", email: email)
|
||||
let to = Mail.User(name: "Megaman", email: email)
|
||||
let to2 = Mail.User(name: "Roll", email: email)
|
||||
let text = "Humans and robots living together in harmony and equality: That was my ultimate wish."
|
||||
let html = "<html><img src=\"http://vignette2.wikia.nocookie.net/megaman/images/4/40/StH250RobotMasters.jpg/revision/latest?cb=20130711161323\"/></html>"
|
||||
let imgFilePath = testsDir + "/x.png"
|
||||
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
|
||||
|
||||
let validMessageIdMsg = "Valid Message-Id header found"
|
||||
let invalidMessageIdMsg = "Message-Id header missing or invalid"
|
||||
let multipleMessageIdsMsg = "More than one Message-Id header found"
|
||||
|
||||
// https://www.base64decode.org/
|
||||
let randomText1 = "Picture removal detract earnest is by. Esteems met joy attempt way clothes yet demesne tedious. Replying an marianne do it an entrance advanced. Two dare say play when hold. Required bringing me material stanhill jointure is as he. Mutual indeed yet her living result matter him bed whence."
|
||||
|
||||
let randomText1Encoded = "UGljdHVyZSByZW1vdmFsIGRldHJhY3QgZWFybmVzdCBpcyBieS4gRXN0ZWVtcyBtZXQgam95IGF0dGVtcHQgd2F5IGNsb3RoZXMgeWV0IGRlbWVzbmUgdGVkaW91cy4gUmVwbHlpbmcgYW4gbWFyaWFubmUgZG8gaXQgYW4gZW50cmFuY2UgYWR2YW5jZWQuIFR3byBkYXJlIHNheSBwbGF5IHdoZW4gaG9sZC4gUmVxdWlyZWQgYnJpbmdpbmcgbWUgbWF0ZXJpYWwgc3RhbmhpbGwgam9pbnR1cmUgaXMgYXMgaGUuIE11dHVhbCBpbmRlZWQgeWV0IGhlciBsaXZpbmcgcmVzdWx0IG1hdHRlciBoaW0gYmVkIHdoZW5jZS4="
|
||||
let randomText1EncodedWithLineLimit = """
|
||||
UGljdHVyZSByZW1vdmFsIGRldHJhY3QgZWFybmVzdCBpcyBieS4gRXN0ZWVtcyBtZXQgam95IGF0
|
||||
dGVtcHQgd2F5IGNsb3RoZXMgeWV0IGRlbWVzbmUgdGVkaW91cy4gUmVwbHlpbmcgYW4gbWFyaWFu
|
||||
bmUgZG8gaXQgYW4gZW50cmFuY2UgYWR2YW5jZWQuIFR3byBkYXJlIHNheSBwbGF5IHdoZW4gaG9s
|
||||
ZC4gUmVxdWlyZWQgYnJpbmdpbmcgbWUgbWF0ZXJpYWwgc3RhbmhpbGwgam9pbnR1cmUgaXMgYXMg
|
||||
aGUuIE11dHVhbCBpbmRlZWQgeWV0IGhlciBsaXZpbmcgcmVzdWx0IG1hdHRlciBoaW0gYmVkIHdo
|
||||
ZW5jZS4=
|
||||
""".replacingOccurrences(of: "\n", with: "\r\n")
|
||||
|
||||
let randomText2 = "Brillo viento gas esa contar hay. Alla no toda lune faro daba en pero. Ir rumiar altura id venian. El robusto hablado ya diarios tu hacerla mermado. Las sus renunciaba llamaradas misteriosa doscientas favorcillo dos pie. Una era fue pedirselos periodicos doscientas actualidad con. Exigian un en oh algunos adivino parezca notario yo. Eres oro dos mal lune vivo sepa les seda. Tio energia una esa abultar por tufillo sirenas persona suspiro. Me pandero tardaba pedirme puertas so senales la."
|
||||
|
||||
let randomText2Encoded = "QnJpbGxvIHZpZW50byBnYXMgZXNhIGNvbnRhciBoYXkuIEFsbGEgbm8gdG9kYSBsdW5lIGZhcm8gZGFiYSBlbiBwZXJvLiBJciBydW1pYXIgYWx0dXJhIGlkIHZlbmlhbi4gRWwgcm9idXN0byBoYWJsYWRvIHlhIGRpYXJpb3MgdHUgaGFjZXJsYSBtZXJtYWRvLiBMYXMgc3VzIHJlbnVuY2lhYmEgbGxhbWFyYWRhcyBtaXN0ZXJpb3NhIGRvc2NpZW50YXMgZmF2b3JjaWxsbyBkb3MgcGllLiBVbmEgZXJhIGZ1ZSBwZWRpcnNlbG9zIHBlcmlvZGljb3MgZG9zY2llbnRhcyBhY3R1YWxpZGFkIGNvbi4gRXhpZ2lhbiB1biBlbiBvaCBhbGd1bm9zIGFkaXZpbm8gcGFyZXpjYSBub3RhcmlvIHlvLiBFcmVzIG9ybyBkb3MgbWFsIGx1bmUgdml2byBzZXBhIGxlcyBzZWRhLiBUaW8gZW5lcmdpYSB1bmEgZXNhIGFidWx0YXIgcG9yIHR1ZmlsbG8gc2lyZW5hcyBwZXJzb25hIHN1c3Bpcm8uIE1lIHBhbmRlcm8gdGFyZGFiYSBwZWRpcm1lIHB1ZXJ0YXMgc28gc2VuYWxlcyBsYS4="
|
||||
let randomText2EncodedWithLineLimit = """
|
||||
QnJpbGxvIHZpZW50byBnYXMgZXNhIGNvbnRhciBoYXkuIEFsbGEgbm8gdG9kYSBsdW5lIGZhcm8g
|
||||
ZGFiYSBlbiBwZXJvLiBJciBydW1pYXIgYWx0dXJhIGlkIHZlbmlhbi4gRWwgcm9idXN0byBoYWJs
|
||||
YWRvIHlhIGRpYXJpb3MgdHUgaGFjZXJsYSBtZXJtYWRvLiBMYXMgc3VzIHJlbnVuY2lhYmEgbGxh
|
||||
bWFyYWRhcyBtaXN0ZXJpb3NhIGRvc2NpZW50YXMgZmF2b3JjaWxsbyBkb3MgcGllLiBVbmEgZXJh
|
||||
IGZ1ZSBwZWRpcnNlbG9zIHBlcmlvZGljb3MgZG9zY2llbnRhcyBhY3R1YWxpZGFkIGNvbi4gRXhp
|
||||
Z2lhbiB1biBlbiBvaCBhbGd1bm9zIGFkaXZpbm8gcGFyZXpjYSBub3RhcmlvIHlvLiBFcmVzIG9y
|
||||
byBkb3MgbWFsIGx1bmUgdml2byBzZXBhIGxlcyBzZWRhLiBUaW8gZW5lcmdpYSB1bmEgZXNhIGFi
|
||||
dWx0YXIgcG9yIHR1ZmlsbG8gc2lyZW5hcyBwZXJzb25hIHN1c3Bpcm8uIE1lIHBhbmRlcm8gdGFy
|
||||
ZGFiYSBwZWRpcm1lIHB1ZXJ0YXMgc28gc2VuYWxlcyBsYS4=
|
||||
""".replacingOccurrences(of: "\n", with: "\r\n")
|
||||
|
||||
let randomText3 = "Intueor veritas suo majoris attinet rem res aggredi similia mei. Disputari abducerem ob ex ha interitum conflatos concipiam. Curam plura aequo rem etc serio fecto caput. Ea posterum lectorem remanere experiar videamus gi cognitum vi. Ad invenit accepit to petitis ea usitata ad. Hoc nam quibus hos oculis cumque videam ita. Res cau infinitum quadratam sanguinem."
|
||||
|
||||
let randomText3Encoded = "SW50dWVvciB2ZXJpdGFzIHN1byBtYWpvcmlzIGF0dGluZXQgcmVtIHJlcyBhZ2dyZWRpIHNpbWlsaWEgbWVpLiBEaXNwdXRhcmkgYWJkdWNlcmVtIG9iIGV4IGhhIGludGVyaXR1bSBjb25mbGF0b3MgY29uY2lwaWFtLiBDdXJhbSBwbHVyYSBhZXF1byByZW0gZXRjIHNlcmlvIGZlY3RvIGNhcHV0LiBFYSBwb3N0ZXJ1bSBsZWN0b3JlbSByZW1hbmVyZSBleHBlcmlhciB2aWRlYW11cyBnaSBjb2duaXR1bSB2aS4gQWQgaW52ZW5pdCBhY2NlcGl0IHRvIHBldGl0aXMgZWEgdXNpdGF0YSBhZC4gSG9jIG5hbSBxdWlidXMgaG9zIG9jdWxpcyBjdW1xdWUgdmlkZWFtIGl0YS4gUmVzIGNhdSBpbmZpbml0dW0gcXVhZHJhdGFtIHNhbmd1aW5lbS4="
|
||||
let randomText3EncodedWithLineLimit = """
|
||||
SW50dWVvciB2ZXJpdGFzIHN1byBtYWpvcmlzIGF0dGluZXQgcmVtIHJlcyBhZ2dyZWRpIHNpbWls
|
||||
aWEgbWVpLiBEaXNwdXRhcmkgYWJkdWNlcmVtIG9iIGV4IGhhIGludGVyaXR1bSBjb25mbGF0b3Mg
|
||||
Y29uY2lwaWFtLiBDdXJhbSBwbHVyYSBhZXF1byByZW0gZXRjIHNlcmlvIGZlY3RvIGNhcHV0LiBF
|
||||
YSBwb3N0ZXJ1bSBsZWN0b3JlbSByZW1hbmVyZSBleHBlcmlhciB2aWRlYW11cyBnaSBjb2duaXR1
|
||||
bSB2aS4gQWQgaW52ZW5pdCBhY2NlcGl0IHRvIHBldGl0aXMgZWEgdXNpdGF0YSBhZC4gSG9jIG5h
|
||||
bSBxdWlidXMgaG9zIG9jdWxpcyBjdW1xdWUgdmlkZWFtIGl0YS4gUmVzIGNhdSBpbmZpbml0dW0g
|
||||
cXVhZHJhdGFtIHNhbmd1aW5lbS4=
|
||||
""".replacingOccurrences(of: "\n", with: "\r\n")
|
||||
|
||||
@@ -22,7 +22,8 @@ class TestAttachment: XCTestCase {
|
||||
return [
|
||||
("testDataAttachmentHeaders", testDataAttachmentHeaders),
|
||||
("testFileAttachmentHeaders", testFileAttachmentHeaders),
|
||||
("testHTMLAttachmentHeaders", testHTMLAttachmentHeaders)
|
||||
("testHTMLAttachmentHeaders", testHTMLAttachmentHeaders),
|
||||
("testGetAlternativeAttachment", testGetAlternativeAttachment)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ class TestAttachment: XCTestCase {
|
||||
}
|
||||
|
||||
func testFileAttachmentHeaders() {
|
||||
let headers = Attachment(filePath: imgFilePath, additionalHeaders: [("CONTENT-ID", "megaman-pic")]).headersString
|
||||
let headers = Attachment(filePath: imgFilePath, additionalHeaders: ["CONTENT-ID": "megaman-pic"]).headersString
|
||||
XCTAssert(headers.contains("CONTENT-DISPOSITION: attachment; filename=\"=?UTF-8?Q?x.png?=\""))
|
||||
XCTAssert(headers.contains("CONTENT-TRANSFER-ENCODING: BASE64"))
|
||||
XCTAssert(headers.contains("CONTENT-ID: megaman-pic"))
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ import XCTest
|
||||
|
||||
class TestDataSender: XCTestCase {
|
||||
static var allTests = [
|
||||
("testDataCache", testDataCache),
|
||||
("testFileCache", testFileCache),
|
||||
("testHTMLCache", testHTMLCache),
|
||||
("testSendData", testSendData),
|
||||
("testSendFile", testSendFile),
|
||||
("testSendHTML", testSendHTML),
|
||||
@@ -35,163 +32,10 @@ class TestDataSender: XCTestCase {
|
||||
("testSendRelatedAttachment", testSendRelatedAttachment)
|
||||
]
|
||||
|
||||
func testDataCache() throws {
|
||||
let expectation = self.expectation(description: "\(#function)")
|
||||
defer {
|
||||
waitForExpectations(timeout: testDuration) { (error) in
|
||||
if let error = error {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
|
||||
var sender: Sender?
|
||||
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (socket, error) in
|
||||
XCTAssertNil(error)
|
||||
|
||||
if let socket = socket {
|
||||
let attachment = Attachment(data: data, mime: "application/json", name: "file.json")
|
||||
let mail = Mail(from: from, to: [to], subject: #function, attachments: [attachment])
|
||||
|
||||
sender = Sender(socket: socket, pending: [mail], progress: nil) { (sent, failed) in
|
||||
XCTAssertEqual(sent.count, 1)
|
||||
XCTAssertEqual(failed.count, 0)
|
||||
group.leave()
|
||||
}
|
||||
sender?.send()
|
||||
}
|
||||
}.login()
|
||||
|
||||
group.wait()
|
||||
|
||||
#if os(macOS)
|
||||
let cached = sender?.dataSender.cache.object(forKey: data as AnyObject)
|
||||
#else
|
||||
let cached = sender?.dataSender.cache.object(forKey: NSData(data: data) as AnyObject)
|
||||
#endif
|
||||
XCTAssertNotNil(cached)
|
||||
|
||||
expectation.fulfill()
|
||||
}
|
||||
|
||||
func testFileCache() throws {
|
||||
let expectation = self.expectation(description: "\(#function)")
|
||||
defer {
|
||||
waitForExpectations(timeout: testDuration) { (error) in
|
||||
if let error = error {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
|
||||
var sender: Sender?
|
||||
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (socket, error) in
|
||||
XCTAssertNil(error)
|
||||
|
||||
if let socket = socket {
|
||||
let attachment = Attachment(filePath: imgFilePath)
|
||||
let mail = Mail(from: from, to: [to], subject: #function, attachments: [attachment])
|
||||
|
||||
sender = Sender(socket: socket, pending: [mail], progress: nil) { (sent, failed) in
|
||||
XCTAssertEqual(sent.count, 1)
|
||||
XCTAssertEqual(failed.count, 0)
|
||||
group.leave()
|
||||
}
|
||||
sender?.send()
|
||||
}
|
||||
}.login()
|
||||
|
||||
group.wait()
|
||||
|
||||
#if os(macOS)
|
||||
let cached = sender?.dataSender.cache.object(forKey: imgFilePath as AnyObject)
|
||||
#else
|
||||
let cached = sender?.dataSender.cache.object(forKey: NSString(string: imgFilePath) as AnyObject)
|
||||
#endif
|
||||
XCTAssertNotNil(cached)
|
||||
|
||||
expectation.fulfill()
|
||||
}
|
||||
|
||||
func testHTMLCache() throws {
|
||||
let expectation = self.expectation(description: "\(#function)")
|
||||
defer {
|
||||
waitForExpectations(timeout: testDuration) { (error) in
|
||||
if let error = error {
|
||||
XCTFail("\(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
|
||||
var sender: Sender?
|
||||
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (socket, error) in
|
||||
XCTAssertNil(error)
|
||||
|
||||
if let socket = socket {
|
||||
let attachment = Attachment(htmlContent: html)
|
||||
let mail = Mail(from: from, to: [to], subject: #function, attachments: [attachment])
|
||||
|
||||
sender = Sender(socket: socket, pending: [mail], progress: nil) { (sent, failed) in
|
||||
XCTAssertEqual(sent.count, 1)
|
||||
XCTAssertEqual(failed.count, 0)
|
||||
group.leave()
|
||||
}
|
||||
sender?.send()
|
||||
}
|
||||
}.login()
|
||||
|
||||
group.wait()
|
||||
|
||||
#if os(macOS)
|
||||
let cached = sender?.dataSender.cache.object(forKey: html as AnyObject)
|
||||
#else
|
||||
let cached = sender?.dataSender.cache.object(forKey: NSString(string: html) as AnyObject)
|
||||
#endif
|
||||
XCTAssertNotNil(cached)
|
||||
|
||||
expectation.fulfill()
|
||||
}
|
||||
|
||||
func testSendData() {
|
||||
let x = expectation(description: "Send mail with data attachment.")
|
||||
let dataAttachment = Attachment(data: data, mime: "application/json", name: "file.json")
|
||||
let mail = Mail(from: from, to: [to], subject: "Data attachment", attachments: [dataAttachment])
|
||||
let mail = Mail(from: from, to: [to], subject: "Data attachment", text: text, attachments: [dataAttachment])
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
@@ -202,7 +46,7 @@ class TestDataSender: XCTestCase {
|
||||
func testSendFile() {
|
||||
let x = expectation(description: "Send mail with file attachment.")
|
||||
let fileAttachment = Attachment(filePath: imgFilePath)
|
||||
let mail = Mail(from: from, to: [to], subject: "File attachment", attachments: [fileAttachment])
|
||||
let mail = Mail(from: from, to: [to], subject: "File attachment", text: text, attachments: [fileAttachment])
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
@@ -256,9 +100,9 @@ class TestDataSender: XCTestCase {
|
||||
|
||||
func testSendRelatedAttachment() {
|
||||
let x = expectation(description: "Send mail with an attachment that references a related attachment.")
|
||||
let fileAttachment = Attachment(filePath: imgFilePath, additionalHeaders: [("CONTENT-ID", "megaman-pic")])
|
||||
let htmlAttachment = Attachment(htmlContent: "<html><img src=\"cid:megaman-pic\"/>This text is HTML</html>", relatedAttachments: [fileAttachment])
|
||||
let mail = Mail(from: from, to: [to], subject: "HTML with related attachment", attachments: [htmlAttachment])
|
||||
let fileAttachment = Attachment(filePath: imgFilePath, additionalHeaders: ["CONTENT-ID": "megaman-pic"])
|
||||
let htmlAttachment = Attachment(htmlContent: "<html><img src=\"cid:megaman-pic\"/>\(text)</html>", relatedAttachments: [fileAttachment])
|
||||
let mail = Mail(from: from, to: [to], subject: "HTML with related attachment", text: text, attachments: [htmlAttachment])
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import XCTest
|
||||
@testable import SwiftSMTP
|
||||
|
||||
class TestLogin: XCTestCase {
|
||||
static var allTests = [
|
||||
("testBadCredentials", testBadCredentials),
|
||||
("testBadPort", testBadPort),
|
||||
("testLogin", testLogin),
|
||||
("testPlain", testPlain),
|
||||
("testPort0", testPort0)
|
||||
]
|
||||
|
||||
func testBadCredentials() throws {
|
||||
let x = expectation(description: "Fail login with bad credentials.")
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: "",
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (_, err) in
|
||||
if let err = err as? SMTPError, case .badResponse = err {
|
||||
x.fulfill()
|
||||
} else {
|
||||
XCTFail("Received different error other than SMTPError(.badResponse) or no error at all.")
|
||||
}
|
||||
}.login()
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testBadPort() throws {
|
||||
let x = expectation(description: "Login timeout because bad port.")
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: 1,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (_, err) in
|
||||
if let err = err as? SMTPError, case .couldNotConnectToServer(_, _) = err {
|
||||
x.fulfill()
|
||||
} else {
|
||||
XCTFail("Received different error other than SMTPError(.couldNotConnectToServer) or no error at all.")
|
||||
}
|
||||
}.login()
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testLogin() throws {
|
||||
let x = expectation(description: "Login with Login auth.")
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: [.login],
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (_, err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
}.login()
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testPlain() throws {
|
||||
let x = expectation(description: "Login with Plain auth.")
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: port,
|
||||
ssl: ssl,
|
||||
authMethods: [.plain],
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (_, err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
}.login()
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testPort0() throws {
|
||||
let x = expectation(description: "Fail login because port can't be 0.")
|
||||
try Login(hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: 0,
|
||||
ssl: ssl,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
accessToken: nil,
|
||||
timeout: timeout) { (_, err) in
|
||||
XCTAssertNotNil(err, "Should get error here, but error was nil.")
|
||||
x.fulfill()
|
||||
}.login()
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
}
|
||||
@@ -21,22 +21,24 @@ import XCTest
|
||||
import Dispatch
|
||||
#endif
|
||||
|
||||
class TestSender: XCTestCase {
|
||||
class TestMailSender: XCTestCase {
|
||||
static var allTests = [
|
||||
("testBadEmail", testBadEmail),
|
||||
("testIsValidEmail", testIsValidEmail),
|
||||
("testSendMail", testSendMail),
|
||||
("testSendMailInArray", testSendMailInArray),
|
||||
("testSendMailNoRecipient", testSendMailNoRecipient),
|
||||
("testSendMailsConcurrently", testSendMailsConcurrently),
|
||||
("testSendMailWithCc", testSendMailWithCc),
|
||||
("testSendMailToMultipleRecipients", testSendMailToMultipleRecipients),
|
||||
("testSendMailWithBcc", testSendMailWithBcc),
|
||||
("testSendMailWithCc", testSendMailWithCc),
|
||||
("testSendMultipleMails", testSendMultipleMails),
|
||||
("testSendMultipleMailsWithFail", testSendMultipleMailsWithFail),
|
||||
("testSendMultipleRecipients", testSendMultipleRecipients)
|
||||
("testSendNoMail", testSendNoMail)
|
||||
]
|
||||
|
||||
func testBadEmail() {
|
||||
let x = expectation(description: "Send a mail that will fail because of an invalid receiving address.")
|
||||
let user = User(email: "")
|
||||
let user = Mail.User(email: "")
|
||||
let mail = Mail(from: user, to: [user])
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNotNil(err, "Sending mail to an invalid email address should return an error, but return nil.")
|
||||
@@ -45,25 +47,40 @@ class TestSender: XCTestCase {
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testIsValidEmail() throws {
|
||||
XCTAssert(try email.isValidEmail(), "\(email) should be a valid email.")
|
||||
XCTAssertFalse(try "".isValidEmail(), "Blank email should be in invalid email.")
|
||||
XCTAssertFalse(try "a".isValidEmail(), "`a` should be in invalid email.")
|
||||
XCTAssertFalse(try "@gmail.com".isValidEmail(), "`@gmail.com` should be in invalid email.")
|
||||
XCTAssertFalse(try "email@.com".isValidEmail(), "`email@.com` should be in invalid email.")
|
||||
XCTAssertFalse(try "email@email".isValidEmail(), "`email@email` should be in invalid email.")
|
||||
XCTAssertFalse(try "email@email.a".isValidEmail(), "`email@email.a` should be in invalid email.")
|
||||
XCTAssertFalse(try "email@email.".isValidEmail(), "`email@email.` should be in invalid email.")
|
||||
}
|
||||
|
||||
func testSendMail() {
|
||||
let x = expectation(description: "Send a simple email.")
|
||||
let mail = Mail(from: from, to: [to2], subject: "Simple email", text: text)
|
||||
let x = expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
let mail = Mail(from: from, to: [to], subject: #function, text: text)
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
}
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testSendMailInArray() {
|
||||
let x = expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
let mail = Mail(from: from, to: [to], subject: #function, text: text)
|
||||
smtp.send([mail], completion: { _, failed in
|
||||
XCTAssert(failed.isEmpty)
|
||||
x.fulfill()
|
||||
})
|
||||
}
|
||||
|
||||
func testSendMailNoRecipient() {
|
||||
let x = expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
let mail = Mail(from: from, to: [], subject: #function, text: text)
|
||||
smtp.send(mail) { (error) in
|
||||
guard let error = error as? SMTPError, case .noRecipients = error else {
|
||||
XCTFail("Received different error other than SMTPError.noRecipients or no error at all.")
|
||||
return
|
||||
}
|
||||
x.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
func testSendMailsConcurrently() {
|
||||
@@ -72,24 +89,21 @@ class TestSender: XCTestCase {
|
||||
let mail2 = Mail(from: from, to: [to], subject: "Send mails concurrently 2")
|
||||
let mails = [mail1, mail2]
|
||||
let group = DispatchGroup()
|
||||
|
||||
for mail in mails {
|
||||
group.enter()
|
||||
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
group.leave()
|
||||
}
|
||||
}
|
||||
|
||||
group.wait()
|
||||
x.fulfill()
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testSendMailWithCc() {
|
||||
let x = expectation(description: "Send mail with Cc.")
|
||||
let mail = Mail(from: from, to: [to], cc: [to2], subject: "Mail with Cc")
|
||||
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()
|
||||
@@ -99,7 +113,17 @@ class TestSender: XCTestCase {
|
||||
|
||||
func testSendMailWithBcc() {
|
||||
let x = expectation(description: "Send mail with Bcc.")
|
||||
let mail = Mail(from: from, to: [to], bcc: [to2], subject: "Mail with Bcc")
|
||||
let mail = Mail(from: from, to: [to], bcc: [to2], subject: #function)
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
}
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testSendMailWithCc() {
|
||||
let x = expectation(description: "Send mail with Cc.")
|
||||
let mail = Mail(from: from, to: [to], cc: [to2], subject: #function)
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
x.fulfill()
|
||||
@@ -123,11 +147,10 @@ class TestSender: XCTestCase {
|
||||
|
||||
func testSendMultipleMailsWithFail() {
|
||||
let x = expectation(description: "Send two mails, one of which will fail.")
|
||||
let badUser = User(email: "")
|
||||
let badUser = Mail.User(email: "")
|
||||
let badMail = Mail(from: from, to: [badUser])
|
||||
let goodMail = Mail(from: from, to: [to], subject: "Send multiple mails with fail")
|
||||
|
||||
smtp.send([badMail, goodMail]) { (sent, failed) in
|
||||
smtp.send([badMail, goodMail], completion: { (sent, failed) in
|
||||
guard sent.count == 1 && failed.count == 1 else {
|
||||
XCTFail("Send did not complete with 1 mail sent and 1 mail failed.")
|
||||
return
|
||||
@@ -136,18 +159,17 @@ class TestSender: XCTestCase {
|
||||
XCTAssertEqual(failed[0].0.id, badMail.id, "Invalid email returned does not match the invalid email sent.")
|
||||
XCTAssertNotNil(failed[0].1, "Invalid email did not return an error when sending.")
|
||||
x.fulfill()
|
||||
}
|
||||
|
||||
})
|
||||
waitForExpectations(timeout: testDuration)
|
||||
}
|
||||
|
||||
func testSendMultipleRecipients() {
|
||||
let x = expectation(description: "Send a single mail to multiple recipients.")
|
||||
let mail = Mail(from: from, to: [to, to2], subject: "Multiple recipients")
|
||||
smtp.send(mail) { (err) in
|
||||
XCTAssertNil(err, String(describing: err))
|
||||
func testSendNoMail() {
|
||||
let x = expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
smtp.send([], completion: { (sent, failed) in
|
||||
XCTAssert(sent.isEmpty)
|
||||
XCTAssert(failed.isEmpty)
|
||||
x.fulfill()
|
||||
}
|
||||
waitForExpectations(timeout: testDuration)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -23,12 +23,12 @@ import XCTest
|
||||
|
||||
class TestMiscellaneous: XCTestCase {
|
||||
static var allTests = [
|
||||
("testBase64Encoded", testBase64Encoded),
|
||||
("testMimeEncoded", testMimeEncoded),
|
||||
("testDateFormatter", testDateFormatter),
|
||||
("testMailHeaders", testMailHeaders),
|
||||
("testMimeNoName", testMimeNoName),
|
||||
("testMimeWithName", testMimeWithName),
|
||||
("testBase64Encoded", testBase64Encoded),
|
||||
("testMimeEncoded", testMimeEncoded)
|
||||
("testMimeWithName", testMimeWithName)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -45,6 +45,18 @@ extension TestMiscellaneous {
|
||||
XCTAssertEqual(result3, randomText3Encoded, "result: \(result3) != expected: \(randomText3Encoded)")
|
||||
}
|
||||
|
||||
func testBase64EncodedWithLineLimit() {
|
||||
let result1 = randomText1.base64EncodedWithLineLimit
|
||||
XCTAssertEqual(result1, randomText1EncodedWithLineLimit, "result: \(result1) != expected: \(randomText1Encoded)")
|
||||
|
||||
let result2 = randomText2.base64EncodedWithLineLimit
|
||||
XCTAssertEqual(result2, randomText2EncodedWithLineLimit, "result: \(result2) != expected: \(randomText2Encoded)")
|
||||
|
||||
let result3 = randomText3.base64EncodedWithLineLimit
|
||||
XCTAssertEqual(result3, randomText3EncodedWithLineLimit, "result: \(result3) != expected: \(randomText3Encoded)")
|
||||
}
|
||||
|
||||
|
||||
func testMimeEncoded() {
|
||||
let result = "Water you up to?".mimeEncoded
|
||||
let expected = "=?UTF-8?Q?Water_you_up_to??="
|
||||
@@ -64,7 +76,7 @@ extension TestMiscellaneous {
|
||||
}
|
||||
|
||||
func testMailHeaders() {
|
||||
let headers = Mail(from: from, to: [to], cc: [to2], subject: "Test", text: text, additionalHeaders: [("header", "val")]).headersString
|
||||
let headers = Mail(from: from, to: [to], cc: [to2], subject: "Test", text: text, additionalHeaders: ["header": "val"]).headersString
|
||||
|
||||
let to_ = "TO: =?UTF-8?Q?Megaman?= <\(email)>"
|
||||
XCTAssert(headers.contains(to_), "Mail header did not contain \(to_)")
|
||||
@@ -78,22 +90,52 @@ extension TestMiscellaneous {
|
||||
let mimeVersion = "MIME-VERSION: 1.0 (Swift-SMTP)"
|
||||
XCTAssert(headers.contains(mimeVersion), "Mail header did not contain \(mimeVersion)")
|
||||
|
||||
let additionalHeader = Header("header", "val")
|
||||
XCTAssert(headers.contains(additionalHeader.header), "Mail header did not contain \(additionalHeader.header)")
|
||||
XCTAssert(headers.contains(additionalHeader.value), "Mail header did not contain \(additionalHeader.value)")
|
||||
let messageIdSearchResponse = findMessageId(inString: headers)
|
||||
XCTAssert(validMessageIdMsg == messageIdSearchResponse, messageIdSearchResponse)
|
||||
|
||||
XCTAssert(headers.contains("HEADER"), "Mail header did not contain \"header\".")
|
||||
XCTAssert(headers.contains("val"), "Mail header did not contain \"val\".")
|
||||
}
|
||||
|
||||
private func findMessageId(inString compareString: String) -> String {
|
||||
let messageIdHeaderPrefix = "MESSAGE-ID: <"
|
||||
// example uuid: E621E1F8-C36C-495A-93FC-0C247A3E6E5F
|
||||
let uuidRegEx = "[A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}"
|
||||
let messageIdHeaderSuffix = ".Swift-SMTP@\(senderEmailDomain)>"
|
||||
let regexPattern = "\(messageIdHeaderPrefix)\(uuidRegEx)\(messageIdHeaderSuffix)"
|
||||
|
||||
guard let regex = try? NSRegularExpression(pattern: regexPattern, options: .anchorsMatchLines) else {
|
||||
return "Unable to create Regular Expression object"
|
||||
}
|
||||
|
||||
let rangeLocation = 0
|
||||
let rangeLength = NSString(string: compareString).length
|
||||
let searchRange = NSRange(location: rangeLocation, length: rangeLength)
|
||||
|
||||
// run the regex
|
||||
let matches = regex.matches(in: compareString, options: .withoutAnchoringBounds, range: searchRange)
|
||||
|
||||
switch matches.count {
|
||||
case 0:
|
||||
return invalidMessageIdMsg
|
||||
case 1:
|
||||
return validMessageIdMsg
|
||||
default:
|
||||
return multipleMessageIdsMsg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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)")
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2018
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
import XCTest
|
||||
@testable import SwiftSMTP
|
||||
|
||||
class TestTLSMode: XCTestCase {
|
||||
static var allTests = [
|
||||
("testNormal", testNormal),
|
||||
/*("testIgnoreTLS", testIgnoreTLS),*/
|
||||
("testRequireTLS", testRequireTLS),
|
||||
("testRequireSTARTTLS", testRequireSTARTTLS)
|
||||
]
|
||||
|
||||
func testNormal() {
|
||||
let expectation = self.expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
do {
|
||||
_ = try SMTPSocket(
|
||||
hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: portPlain,
|
||||
tlsMode: .normal,
|
||||
tlsConfiguration: nil,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
timeout: timeout
|
||||
)
|
||||
expectation.fulfill()
|
||||
} catch {
|
||||
XCTFail(String(describing: error))
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
// This test is for a mail server that requires STARTTLS authentication. The current mail server being used for CI builds does not require STARTTLS for non-SSL ports. So this test cannot pass successfully.
|
||||
/*
|
||||
func testIgnoreTLS() {
|
||||
let expectation = self.expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
do {
|
||||
_ = try SMTPSocket(
|
||||
hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: portPlain,
|
||||
tlsMode: .ignoreTLS,
|
||||
tlsConfiguration: nil,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
timeout: timeout
|
||||
)
|
||||
XCTFail()
|
||||
expectation.fulfill()
|
||||
} catch {
|
||||
if case SMTPError.noAuthMethodsOrRequiresTLS = error {
|
||||
expectation.fulfill()
|
||||
} else {
|
||||
XCTFail(String(describing: error))
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func testRequireTLS() {
|
||||
let expectation = self.expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
do {
|
||||
_ = try SMTPSocket(
|
||||
hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: 465,
|
||||
tlsMode: .requireTLS,
|
||||
tlsConfiguration: nil,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
timeout: timeout
|
||||
)
|
||||
expectation.fulfill()
|
||||
} catch {
|
||||
XCTFail(String(describing: error))
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
func testRequireSTARTTLS() {
|
||||
let expectation = self.expectation(description: #function)
|
||||
defer { waitForExpectations(timeout: testDuration) }
|
||||
|
||||
do {
|
||||
_ = try SMTPSocket(
|
||||
hostname: hostname,
|
||||
email: email,
|
||||
password: password,
|
||||
port: portPlain,
|
||||
tlsMode: .requireSTARTTLS,
|
||||
tlsConfiguration: nil,
|
||||
authMethods: authMethods,
|
||||
domainName: domainName,
|
||||
timeout: timeout
|
||||
)
|
||||
expectation.fulfill()
|
||||
} catch {
|
||||
XCTFail(String(describing: error))
|
||||
expectation.fulfill()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/**
|
||||
* Copyright IBM Corporation 2017
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
#if os(OSX)
|
||||
import XCTest
|
||||
|
||||
class VerifyLinuxTextCount: XCTestCase {
|
||||
func verifyLinuxTextCount() {
|
||||
var linuxCount: Int
|
||||
var darwinCount: Int
|
||||
|
||||
// TestAttachment
|
||||
linuxCount = TestAttachment.allTests.count
|
||||
darwinCount = Int(TestAttachment.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestAttachment.allTests")
|
||||
|
||||
// TestAuthEncoder
|
||||
linuxCount = TestAuthEncoder.allTests.count
|
||||
darwinCount = Int(TestAuthEncoder.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestAuthEncoder.allTests")
|
||||
|
||||
// TestDataSender
|
||||
linuxCount = TestDataSender.allTests.count
|
||||
darwinCount = Int(TestDataSender.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestDataSender.allTests")
|
||||
|
||||
// TestLogin
|
||||
linuxCount = TestLogin.allTests.count
|
||||
darwinCount = Int(TestLogin.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestLogin.allTests")
|
||||
|
||||
// TestMiscellaneous
|
||||
linuxCount = TestMiscellaneous.allTests.count
|
||||
darwinCount = Int(TestMiscellaneous.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestMiscellaneous.allTests")
|
||||
|
||||
// TestSender
|
||||
linuxCount = TestSender.allTests.count
|
||||
darwinCount = Int(TestSender.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestSender.allTests")
|
||||
|
||||
// TestSMTPSocket
|
||||
linuxCount = TestSMTPSocket.allTests.count
|
||||
darwinCount = Int(TestSMTPSocket.defaultTestSuite().testCaseCount)
|
||||
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestSMTPSocket.allTests")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+26
-57
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enums Reference</title>
|
||||
<title>Enumerations Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
|
||||
|
||||
<a title="Enums Reference"></a>
|
||||
<a title="Enumerations Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -32,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -43,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Enums Reference
|
||||
Enumerations Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,9 +100,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Enums</h1>
|
||||
<p>The following enums are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Enumerations</h1>
|
||||
<p>The following enumerations are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -113,37 +114,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O9SwiftSMTP5Ports"></a>
|
||||
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O9SwiftSMTP5Ports">Ports</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Common <code><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
|
||||
|
||||
<a href="Enums/Ports.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O9SwiftSMTP10AuthMethod"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO"></a>
|
||||
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O9SwiftSMTP10AuthMethod">AuthMethod</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO">AuthMethod</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -159,23 +132,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O9SwiftSMTP9SMTPError"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O9SwiftSMTP9SMTPError">SMTPError</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO">SMTPError</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -191,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>
|
||||
@@ -206,8 +175,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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>
|
||||
|
||||
+31
-42
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>AuthMethod Enum Reference</title>
|
||||
<title>AuthMethod Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
|
||||
|
||||
<a title="AuthMethod Enum Reference"></a>
|
||||
<a title="AuthMethod Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
AuthMethod Enum Reference
|
||||
AuthMethod Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -120,9 +121,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_">cramMD5</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -137,23 +138,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_">login</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -168,23 +165,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_">plain</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -199,23 +192,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_">xoauth2</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -230,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>
|
||||
@@ -245,8 +234,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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,191 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Ports Enum Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
|
||||
|
||||
<a title="Ports Enum Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SwiftSMTP Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
Ports Enum Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Ports</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Common <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/tls" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_">tls</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Default <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">tls</span> <span class="o">=</span> <span class="mi">587</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP5Ports3sslFMS0_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/ssl" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP5Ports3sslFMS0_S0_">ssl</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> used to connect securely.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">ssl</span> <span class="o">=</span> <span class="mi">465</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
+86
-129
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SMTPError Enum Reference</title>
|
||||
<title>SMTPError Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
|
||||
|
||||
<a title="SMTPError Enum Reference"></a>
|
||||
<a title="SMTPError Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SMTPError Enum Reference
|
||||
SMTPError Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -120,9 +121,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_">base64DecodeFail</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/base64DecodeFail(string:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF">base64DecodeFail(string:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -137,23 +138,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_">md5HashChallengeFail</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -168,23 +165,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_">fileNotFound</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/fileNotFound(path:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF">fileNotFound(path:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -199,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:FO9SwiftSMTP9SMTPError23couldNotConnectToServerFMS0_FT6serverSS7timeoutSi_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/couldNotConnectToServer" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError23couldNotConnectToServerFMS0_FT6serverSS7timeoutSi_S0_">couldNotConnectToServer</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">
|
||||
@@ -223,32 +212,26 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Could not connect to server within specified timeout. Ensure your
|
||||
server can connect through <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> 587 or specify which <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> to connect
|
||||
on. Some SMTP servers may require a longer timeout.</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">couldNotConnectToServer</span><span class="p">(</span><span class="nv">server</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">timeout</span><span class="p">:</span> <span class="kt">Int</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:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_">noSupportedAuthMethods</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/noRecipients" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF">noRecipients</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -256,63 +239,26 @@ on. Some SMTP servers may require a longer timeout.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The preferred <code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s could not be found. Connecting with <code><a href="../Structs/SSL.html">SSL</a></code>
|
||||
may be required.</p>
|
||||
<p>Mail has no recipients.</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="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:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/noAccessToken" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_">noAccessToken</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Attempted to login using <code>XOAUTH2</code> but <code><a href="../Structs/SMTP.html">SMTP</a></code> instance was initialized
|
||||
without an access token.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">noAccessToken</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/createEmailRegexFailed" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_">createEmailRegexFailed</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF">createEmailRegexFailed</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -327,23 +273,19 @@ without an access token.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_">badResponse</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/badResponse(command:response:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF">badResponse(command:<wbr>response:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -358,23 +300,19 @@ without an access token.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_">convertDataUTF8Fail</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/convertDataUTF8Fail(data:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF">convertDataUTF8Fail(data:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -389,23 +327,19 @@ without an access token.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_">invalidEmail</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidEmail(email:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF">invalidEmail(email:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -413,30 +347,53 @@ without an access token.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Invalid email provided for <code><a href="../Structs/User.html">User</a></code>.</p>
|
||||
<p>Invalid email provided for <code>User</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vO9SwiftSMTP9SMTPError11descriptionSS"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/requiredSTARTTLS" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF">requiredSTARTTLS</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>STARTTLS was required but the server did not request it.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requiredSTARTTLS</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vO9SwiftSMTP9SMTPError11descriptionSS">description</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -451,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>
|
||||
@@ -466,8 +423,8 @@ without an access token.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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>
|
||||
|
||||
+37
-80
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Structs Reference</title>
|
||||
<title>Structures Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
|
||||
|
||||
<a title="Structs Reference"></a>
|
||||
<a title="Structures Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -32,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -43,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Structs Reference
|
||||
Structures Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,9 +100,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Structs</h1>
|
||||
<p>The following structs are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Structures</h1>
|
||||
<p>The following structures are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -113,9 +114,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP10Attachment"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP10Attachment">Attachment</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV">Attachment</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -132,23 +133,20 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Attachment</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP4Mail"></a>
|
||||
<a name="/s:9SwiftSMTP4MailV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP4Mail">Mail</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV">Mail</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -164,23 +162,19 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP4SMTP"></a>
|
||||
<a name="/s:9SwiftSMTP0B0V"></a>
|
||||
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP4SMTP">SMTP</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V">SMTP</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -188,7 +182,7 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
|
||||
<p>Used to connect to an SMTP server and send emails.</p>
|
||||
|
||||
<a href="Structs/SMTP.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
@@ -196,23 +190,19 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP3SSL"></a>
|
||||
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP3SSL">SSL</a>
|
||||
<a name="/s:9SwiftSMTP16TLSConfigurationV"></a>
|
||||
<a name="//apple_ref/swift/Struct/TLSConfiguration" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV">TLSConfiguration</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -220,48 +210,15 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Configuration to connect securely through SSL/TLS.
|
||||
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></p>
|
||||
<p>Configuration for connecting with TLS. For more info, see <a href="https://github.com/Kitura/BlueSSLService">https://github.com/Kitura/BlueSSLService</a>.</p>
|
||||
|
||||
<a href="Structs/SSL.html" class="slightly-smaller">See more</a>
|
||||
<a href="Structs/TLSConfiguration.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP4User"></a>
|
||||
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP4User">User</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a sender or receiver of an email.</p>
|
||||
|
||||
<a href="Structs/User.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">TLSConfiguration</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -276,8 +233,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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>
|
||||
|
||||
+101
-70
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Attachment Struct Reference</title>
|
||||
<title>Attachment Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
|
||||
|
||||
<a title="Attachment Struct Reference"></a>
|
||||
<a title="Attachment Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
Attachment Struct Reference
|
||||
Attachment Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -121,9 +123,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(data:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_">init(data:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc">init(data:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -138,12 +140,12 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -160,7 +162,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>Raw data to be sent as attachment.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -173,7 +174,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>MIME type of the data.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -186,7 +186,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>File name which will be presented in the mail.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -198,8 +197,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Indicates if attachment is inline. To embed the attachment in mail content, set to <code>true</code>. To send as standalone attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
|
||||
<p>Indicates if attachment is inline. To embed the attachment
|
||||
in mail content, set to <code>true</code>. To send as standalone
|
||||
attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -211,8 +211,11 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the attachment. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the <code><a href="../Structs/Mail.html">Mail</a></code>. Header keys
|
||||
are capitalized and duplicate keys will
|
||||
overwrite each other. Defaults to none. The
|
||||
following will be ignored: CONTENT-TYPE,
|
||||
CONTENT-DISPOSITION, CONTENT-TRANSFER-ENCODING.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -224,8 +227,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to none.</p>
|
||||
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to
|
||||
none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -238,9 +241,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_">init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc">init(filePath:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -255,12 +258,12 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -277,7 +280,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the local file.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -289,8 +291,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>MIME type of the file. Defaults to <code>application/octet-stream</code>.</p>
|
||||
|
||||
<p>MIME type of the file. Defaults to
|
||||
<code>application/octet-stream</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -302,8 +304,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Name of the file. Defaults to the name component in its file path.</p>
|
||||
|
||||
<p>Name of the file. Defaults to the name component in its
|
||||
file path.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -315,8 +317,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Indicates if attachment is inline. To embed the attachment in mail content, set to <code>true</code>. To send as standalone attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
|
||||
<p>Indicates if attachment is inline. To embed the attachment
|
||||
in mail content, set to <code>true</code>. To send as standalone
|
||||
attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -328,8 +331,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the attachment. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the attachment. Header
|
||||
keys are capitalized and duplicate keys will
|
||||
replace each other. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -341,8 +345,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to none.</p>
|
||||
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to
|
||||
none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -355,9 +359,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_">init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc">init(htmlContent:<wbr>characterSet:<wbr>alternative:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -372,11 +376,11 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
|
||||
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
|
||||
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -393,7 +397,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>Content string of HTML.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -405,8 +408,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Character encoding of <code>htmlContent</code>. Defaults to <code>utf-8</code>.</p>
|
||||
|
||||
<p>Character encoding of <code>htmlContent</code>. Defaults to
|
||||
<code>utf-8</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -418,8 +421,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Whether the HTML is an alternative for plain text or not. Defaults to <code>true</code>.</p>
|
||||
|
||||
<p>Whether the HTML is an alternative for plain text or
|
||||
not. Defaults to <code>true</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -431,8 +434,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the attachment. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the attachment. Header
|
||||
keys are capitalized and duplicate keys will
|
||||
replace each other. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -444,8 +448,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to none.</p>
|
||||
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to
|
||||
none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -455,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">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -463,8 +494,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+371
-47
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Mail Struct Reference</title>
|
||||
<title>Mail Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
|
||||
|
||||
<a title="Mail Struct Reference"></a>
|
||||
<a title="Mail Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
Mail Struct Reference
|
||||
Mail Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -120,9 +121,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vV9SwiftSMTP4Mail2idSS"></a>
|
||||
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vV9SwiftSMTP4Mail2idSS">id</a>
|
||||
<a name="/s:9SwiftSMTP4MailV4uuidSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/uuid" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSvp">uuid</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -130,14 +131,14 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>UUID of the <code>Mail</code>.</p>
|
||||
<p>A UUID for the mail.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">id</span> <span class="o">=</span> <span class="kt">UUID</span><span class="p">()</span><span class="o">.</span><span class="n">uuidString</span> <span class="o">+</span> <span class="s">".Swift-SMTP"</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>
|
||||
@@ -147,9 +148,308 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGSaT6headerSS5valueSS___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP4MailV4fromAC4UserVvp"></a>
|
||||
<a name="//apple_ref/swift/Property/from" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAC4UserVvp">from</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV2toSayAC4UserVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/to" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAC4UserVGvp">to</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/cc" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp">cc</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/bcc" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp">bcc</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV7subjectSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/subject" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSvp">subject</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV4textSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/text" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSvp">text</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Text of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">text</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/attachments" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp">attachments</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are alternatives to plain
|
||||
text, the last one will be used as the alternative (all the <code>Attachments</code> will still be sent). Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp"></a>
|
||||
<a name="//apple_ref/swift/Property/alternative" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp">alternative</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Attachment that is an alternative to plain text.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">alternative</span><span class="p">:</span> <span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/additionalHeaders" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp">additionalHeaders</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Additional headers for the <code>Mail</code>. Header keys are capitalized and duplicate keys will overwrite each other.
|
||||
Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION, CONTENT-TRANSFER-ENCODING.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">String</span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV2idSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSvp">id</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>message-id <a href="https://tools.ietf.org/html/rfc5322#section-3.6.4">https://tools.ietf.org/html/rfc5322#section-3.6.4</a></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">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>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV8hostnameSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/hostname" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSvp">hostname</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Hostname from the email address.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGSaT6headerSS5valueSS___S0_">init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc">init(from:<wbr>to:<wbr>cc:<wbr>bcc:<wbr>subject:<wbr>text:<wbr>attachments:<wbr>additionalHeaders:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -164,14 +464,14 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,8 +487,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The <code>User</code> that the <code>Mail</code> will be sent from.</p>
|
||||
|
||||
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -200,8 +499,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>User</code>s to send the <code>Mail</code> to.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -213,8 +511,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>User</code>s to cc. Defaults to none.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -226,8 +523,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>User</code>s to bcc. Defaults to none.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -240,7 +536,6 @@
|
||||
<td>
|
||||
<div>
|
||||
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -253,7 +548,6 @@
|
||||
<td>
|
||||
<div>
|
||||
<p>Text of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -265,8 +559,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>Attachment</code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code>Attachment</code>s that are alternatives to to plain text, the last one will be used as the alternative (all the <code>Attachments</code> will still be sent). Defaults to none.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are
|
||||
alternatives to plain text, the last one will be used as the alternative (all the <code>Attachments</code> will still
|
||||
be sent). Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -278,8 +573,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the <code>Mail</code>. Header keys are capitalized and duplicate keys will
|
||||
overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION,
|
||||
CONTENT-TRANSFER-ENCODING.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -289,6 +585,34 @@
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV4UserV"></a>
|
||||
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV">User</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a sender or receiver of an email.</p>
|
||||
|
||||
<a href="../Structs/Mail/User.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -297,8 +621,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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’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’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’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’s email address.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 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>
|
||||
+106
-93
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SMTP Struct Reference</title>
|
||||
<title>SMTP Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
|
||||
|
||||
<a title="SMTP Struct Reference"></a>
|
||||
<a title="SMTP Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SMTP Struct Reference
|
||||
SMTP Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,15 +100,16 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SMTP</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
|
||||
<p>Used to connect to an SMTP server and send emails.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -120,9 +121,37 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_">init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)</a>
|
||||
<a name="/s:9SwiftSMTP0B0V7TLSModeO"></a>
|
||||
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO">TLSMode</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>TLSMode enum for what form of connection security to enforce.</p>
|
||||
|
||||
<a href="../Structs/SMTP/TLSMode.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:tlsMode:tlsConfiguration:authMethods:domainName:timeout:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc">init(hostname:<wbr>email:<wbr>password:<wbr>port:<wbr>tlsMode:<wbr>tlsConfiguration:<wbr>authMethods:<wbr>domainName:<wbr>timeout:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -131,18 +160,14 @@
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initializes an <code>SMTP</code> instance.</p>
|
||||
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p>Note:</p>
|
||||
|
||||
<ul>
|
||||
<li>Some servers like Gmail support IPv6, and if your network does
|
||||
not, you will first attempt to connect via IPv6, then timeout, and
|
||||
fall back to IPv4. You can avoid this by disabling IPv6 on your
|
||||
machine.</li>
|
||||
<li>You may need to enable access for less secure apps in your account
|
||||
on the SMTP server.</li>
|
||||
<li>You may need to enable access for less secure apps for your account on the SMTP server.</li>
|
||||
<li>Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
|
||||
IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -152,15 +177,15 @@ on the SMTP server.</li>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">port</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span> <span class="o">=</span> <span class="kt"><a href="../Enums/Ports.html">Ports</a></span><span class="o">.</span><span class="n">tls</span><span class="o">.</span><span class="n">rawValue</span><span class="p">,</span>
|
||||
<span class="nv">ssl</span><span class="p">:</span> <span class="kt"><a href="../Structs/SSL.html">SSL</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
|
||||
<span class="nv">accessToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">Int</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">port</span><span class="p">:</span> <span class="kt">Int32</span> <span class="o">=</span> <span class="mi">587</span><span class="p">,</span>
|
||||
<span class="nv">tlsMode</span><span class="p">:</span> <span class="kt"><a href="../Structs/SMTP/TLSMode.html">TLSMode</a></span> <span class="o">=</span> <span class="o">.</span><span class="n">requireSTARTTLS</span><span class="p">,</span>
|
||||
<span class="nv">tlsConfiguration</span><span class="p">:</span> <span class="kt"><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
|
||||
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,21 +201,19 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Hostname of the SMTP server to connect to. Should not include any scheme–ie <code>smtp.example.com</code> is valid.</p>
|
||||
|
||||
<p>Hostname of the SMTP server to connect to, i.e. <code>smtp.example.com</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>user</em>
|
||||
<em>email</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Username to log in to server.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -202,8 +225,7 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Password to log in to server.</p>
|
||||
|
||||
<p>Password to log in to server, or access token if using XOAUTH2 authorization method.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -215,21 +237,32 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>Port</code> to connect to the server on. Defaults to <code>587</code>.</p>
|
||||
|
||||
<p>Port to connect to the server on. Defaults to <code>465</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>ssl</em>
|
||||
<em>tlsMode</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>SSL</code> containing configuration info for connecting securely through SSL/TLS. (optional)</p>
|
||||
|
||||
<p>TLSMode <code>enum</code> indicating what form of connection security to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tlsConfiguration</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> used to connect with TLS. If nil, a configuration with no backing
|
||||
certificates is used. See <code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> for other configuration options.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -241,8 +274,7 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>AuthMethod</code>s to use to log in to the server. Defaults to <code>CRAM-MD5</code>, <code>LOGIN</code>, and <code>PLAIN</code>.</p>
|
||||
|
||||
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. If blank, tries all supported methods.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -255,20 +287,6 @@ on the SMTP server.</li>
|
||||
<td>
|
||||
<div>
|
||||
<p>Client domain name used when communicating with the server. Defaults to <code>localhost</code>.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>accessToken</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Access token used if logging in through <code>XOAUTH2</code>. (optional)</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -281,7 +299,6 @@ on the SMTP server.</li>
|
||||
<td>
|
||||
<div>
|
||||
<p>How long to try connecting to the server to before returning an error. Defaults to <code>10</code> seconds.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -294,9 +311,9 @@ on the SMTP server.</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_"></a>
|
||||
<a name="/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF"></a>
|
||||
<a name="//apple_ref/swift/Method/send(_:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_">send(_:completion:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF">send(_:<wbr>completion:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -311,7 +328,7 @@ on the SMTP server.</li>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-></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">-></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>
|
||||
@@ -327,8 +344,7 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>Mail</code> object to send.</p>
|
||||
|
||||
<p><code><a href="../Structs/Mail.html">Mail</a></code> object to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -341,7 +357,6 @@ on the SMTP server.</li>
|
||||
<td>
|
||||
<div>
|
||||
<p>Callback when sending finishes. <code>Error</code> is nil on success. (optional)</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -354,9 +369,9 @@ on the SMTP server.</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_"></a>
|
||||
<a name="/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF"></a>
|
||||
<a name="//apple_ref/swift/Method/send(_:progress:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_">send(_:progress:completion:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF">send(_:<wbr>progress:<wbr>completion:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -365,21 +380,19 @@ on the SMTP server.</li>
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Send multiple emails.</p>
|
||||
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p>Note:</p>
|
||||
|
||||
<ul>
|
||||
<li>If any of the emails addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>‘s <code>to</code>, <code>cc</code>, or <code>bcc</code>
|
||||
are invalid, the entire mail will not send and return an
|
||||
<code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
|
||||
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s,
|
||||
the whole sending process will not stop until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s
|
||||
are attempted.</li>
|
||||
<li>Each call to <code>send</code> queues it’s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one.
|
||||
To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them in separate calls to
|
||||
<code>send</code>.</li>
|
||||
<li>Each call to <code>send</code> will first log in to your server, attempt to send the mails, then closes the
|
||||
connection. Pass in an array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send them all in one session.</li>
|
||||
<li>If any of the email addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>‘s <code>to</code>, <code>cc</code>, or <code>bcc</code> are invalid, the entire mail will not
|
||||
send and return an <code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
|
||||
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s, the whole sending process will continue
|
||||
until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s are attempted.</li>
|
||||
<li>Each call to <code>send</code> queues it’s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one. To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them
|
||||
in separate calls to <code>send</code>.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -389,9 +402,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
|
||||
<span class="nv">progress</span><span class="p">:</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">completion</span><span class="p">:</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
|
||||
<span class="nv">progress</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">completion</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -407,8 +420,7 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>Mail</code>s to send.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -420,8 +432,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>(<code>Mail</code>, <code>Error</code>) callback after each <code>Mail</code> is sent. <code>Mail</code> is the <code>Mail</code> sent and <code>Error</code> is the error if it failed. (optional)</p>
|
||||
|
||||
<p>(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="../Structs/Mail.html">Mail</a></code> is sent. <code><a href="../Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is
|
||||
the error if it failed. (optional)</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -433,8 +445,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>([<code>Mail</code>], [(<code>Mail</code>, <code>Error</code>)]) callback after all <code>Mail</code>s have been attempted. [<code>Mail</code>] is an array of successfully sent <code>Mail</code>s. [(<code>Mail</code>, <code>Error</code>)] is an array of failed <code>Mail</code>s and their corresponding <code>Error</code>s. (optional)</p>
|
||||
|
||||
<p>([<code><a href="../Structs/Mail.html">Mail</a></code>], [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="../Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="../Structs/Mail.html">Mail</a></code>] is an
|
||||
array of successfully sent <code><a href="../Structs/Mail.html">Mail</a></code>s. [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="../Structs/Mail.html">Mail</a></code>s and their
|
||||
corresponding <code>Error</code>s. (optional)</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -452,8 +465,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,306 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SSL Struct Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
|
||||
|
||||
<a title="SSL Struct Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SwiftSMTP Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SSL Struct Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>SSL</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Configuration to connect securely through SSL/TLS.
|
||||
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></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="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withCipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withChainFilePath:withPassword:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_">init(withChainFilePath:withPassword:usingSelfSignedCerts:cipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>Certificate Chain File</code>.</p>
|
||||
|
||||
<p><em>Note:</em> If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject’s certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.</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="n">withChainFilePath</span> <span class="nv">chainFilePath</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">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">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>chainFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the certificate chain file (optional). </p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>password</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Password for the chain file (optional).</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -0,0 +1,510 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>TLSConfiguration Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<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/TLSConfiguration" class="dashAnchor"></a>
|
||||
|
||||
<a title="TLSConfiguration 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" />
|
||||
TLSConfiguration Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">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>TLSConfiguration</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">TLSConfiguration</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCipherSuite:clientAllowsSelfSignedCertificates:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc">init(withCipherSuite:<wbr>clientAllowsSelfSignedCertificates:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration with no backing certificates.</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="n">withCipherSuite</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>clientAllowsSelfSignedCertificates</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>true</code> to accept self-signed certificates from a server. <code>false</code> otherwise.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<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:9SwiftSMTP16TLSConfigurationV25withCACertificateFilePath016usingCertificateF00d3KeyF00H15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateFilePath:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>CA Certificate</code> file.</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="n">withCACertificateFilePath</span> <span class="nv">caCertificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>caCertificateFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted CA certificate file.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>certificateFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted certificate file.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>keyFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted key file. If nil, <code>certificateFilePath</code> will be used.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<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:9SwiftSMTP16TLSConfigurationV26withCACertificateDirectory20usingCertificateFile0d3KeyI00G15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateDirectory:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>CA Certificate</code> directory.</p>
|
||||
|
||||
<p><em>Note:</em> <code>caCertificateDirPath</code> - All certificates in the specified directory <strong>must</strong> be hashed using the <code>OpenSSL Certificate Tool</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="n">withCACertificateDirectory</span> <span class="nv">caCertificateDirPath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>caCertificateDirPath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to a directory containing CA certificates. <em>(see note above)</em></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>certificateFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted certificate file. If nil, <code>certificateFilePath</code> will be used.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>keyFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted key file (optional). If nil, <code>certificateFilePath</code> is used.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<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:9SwiftSMTP16TLSConfigurationV17withChainFilePath0D8Password20usingSelfSignedCerts012clientAllowsjK12Certificates11cipherSuiteACSSSg_AIS2bAItcfc">init(withChainFilePath:<wbr>withPassword:<wbr>usingSelfSignedCerts:<wbr>clientAllowsSelfSignedCertificates:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>Certificate Chain File</code>.</p>
|
||||
|
||||
<p><em>Note:</em> If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject’s certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.</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="n">withChainFilePath</span> <span class="nv">chainFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">withPassword</span> <span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>chainFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the certificate chain file (optional). <em>(see note above)</em></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>password</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Password for the chain file (optional). If using self-signed certs, a password is required.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
</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>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withPEMCertificateString:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withPEMCertificateString:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>PEM formatted certificate in String form</code>.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,193 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>User Struct Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
|
||||
|
||||
<a title="User Struct Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SwiftSMTP Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
User Struct Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>User</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Represents a sender or receiver of an email.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_">init(name:email:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initializes a <code>User</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>name</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Display name for the user. (optional)</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>email</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Email address for the user.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
+31
-33
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Typealiases Reference</title>
|
||||
<title>Type Aliases Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
|
||||
|
||||
<a title="Typealiases Reference"></a>
|
||||
<a title="Type Aliases Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -32,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -43,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Typealiases Reference
|
||||
Type Aliases Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,9 +100,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Typealiases</h1>
|
||||
<p>The following typealiases are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Type Aliases</h1>
|
||||
<p>The following type aliases are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -113,9 +114,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4Port"></a>
|
||||
<a name="//apple_ref/swift/Alias/Port" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4Port">Port</a>
|
||||
<a name="/s:9SwiftSMTP8Progressa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Progress" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -123,30 +124,26 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Port to connect to SMTP server with.</p>
|
||||
<p>(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="Structs/Mail.html">Mail</a></code> is sent. <code><a href="Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is the error if it failed.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Port</span> <span class="o">=</span> <span class="kt">Int32</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="p">((</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Void</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:9SwiftSMTP6Header"></a>
|
||||
<a name="//apple_ref/swift/Alias/Header" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP6Header">Header</a>
|
||||
<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">
|
||||
@@ -154,14 +151,15 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Custom header for a <code><a href="Structs/Mail.html">Mail</a></code> or <code><a href="Structs/Attachment.html">Attachment</a></code>.</p>
|
||||
<p>([<code><a href="Structs/Mail.html">Mail</a></code>], [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="Structs/Mail.html">Mail</a></code>] is an array of successfully
|
||||
sent <code><a href="Structs/Mail.html">Mail</a></code>s. [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="Structs/Mail.html">Mail</a></code>s and their corresponding <code>Error</code>s.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Header</span> <span class="o">=</span> <span class="p">(</span><span class="nv">header</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">value</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="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">-></span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,8 +174,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
+28
-1
@@ -1 +1,28 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="136" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h93v20H0z"/><path fill="#4c1" d="M93 0h43v20H93z"/><path fill="url(#b)" d="M0 0h136v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="46.5" y="15" fill="#010101" fill-opacity=".3">documentation</text><text x="46.5" y="14">documentation</text><text x="113.5" y="15" fill="#010101" fill-opacity=".3">100%</text><text x="113.5" y="14">100%</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
|
||||
<linearGradient id="b" x2="0" y2="100%">
|
||||
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
||||
<stop offset="1" stop-opacity=".1"/>
|
||||
</linearGradient>
|
||||
<clipPath id="a">
|
||||
<rect width="136" height="20" rx="3" fill="#fff"/>
|
||||
</clipPath>
|
||||
<g clip-path="url(#a)">
|
||||
<path fill="#555" d="M0 0h93v20H0z"/>
|
||||
<path fill="#4c1" d="M93 0h43v20H93z"/>
|
||||
<path fill="url(#b)" d="M0 0h136v20H0z"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
|
||||
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="475" y="140" transform="scale(.1)" textLength="830">
|
||||
documentation
|
||||
</text>
|
||||
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
</text>
|
||||
<text x="1135" y="140" transform="scale(.1)" textLength="330">
|
||||
100%
|
||||
</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 807 B After Width: | Height: | Size: 1.1 KiB |
+36
-9
@@ -63,6 +63,10 @@ a {
|
||||
a:hover, a:focus {
|
||||
outline: 0;
|
||||
text-decoration: underline; }
|
||||
a.discouraged {
|
||||
text-decoration: line-through; }
|
||||
a.discouraged:hover, a.discouraged:focus {
|
||||
text-decoration: underline line-through; }
|
||||
|
||||
table {
|
||||
background: #fff;
|
||||
@@ -90,10 +94,10 @@ pre {
|
||||
code {
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
p > code, li > code {
|
||||
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
|
||||
background: #f7f7f7;
|
||||
padding: .2em; }
|
||||
p > code:before, p > code:after, li > code:before, li > code:after {
|
||||
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
|
||||
letter-spacing: -.2em;
|
||||
content: "\00a0"; }
|
||||
|
||||
@@ -107,7 +111,6 @@ pre code {
|
||||
@media (min-width: 768px) {
|
||||
.content-wrapper {
|
||||
flex-direction: row; } }
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
padding: 8px;
|
||||
@@ -153,7 +156,6 @@ pre code {
|
||||
word-wrap: normal;
|
||||
background: #fbfbfb;
|
||||
border-right: 1px solid #ddd; } }
|
||||
|
||||
.nav-groups {
|
||||
list-style-type: none;
|
||||
padding-left: 0; }
|
||||
@@ -184,7 +186,6 @@ pre code {
|
||||
order: 2;
|
||||
flex: 1;
|
||||
padding-bottom: 60px; } }
|
||||
|
||||
.section {
|
||||
padding: 0 32px;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
@@ -197,6 +198,8 @@ pre code {
|
||||
.section-name {
|
||||
color: #666;
|
||||
display: block; }
|
||||
.section-name p {
|
||||
margin-bottom: inherit; }
|
||||
|
||||
.declaration .highlight {
|
||||
overflow-x: initial;
|
||||
@@ -215,6 +218,22 @@ pre code {
|
||||
content: "";
|
||||
display: block; }
|
||||
|
||||
.section-name-container {
|
||||
position: relative; }
|
||||
.section-name-container .section-name-link {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 0; }
|
||||
.section-name-container .section-name {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
z-index: 1; }
|
||||
.section-name-container .section-name a {
|
||||
pointer-events: auto; }
|
||||
|
||||
.item-container {
|
||||
padding: 0; }
|
||||
|
||||
@@ -225,9 +244,11 @@ pre code {
|
||||
.item a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
.item .token {
|
||||
.item .token, .item .direct-link {
|
||||
display: inline-block;
|
||||
text-indent: -20px;
|
||||
padding-left: 3px;
|
||||
margin-left: 0px;
|
||||
margin-left: 20px;
|
||||
font-size: 1rem; }
|
||||
.item .declaration-note {
|
||||
font-size: .85em;
|
||||
@@ -287,9 +308,9 @@ pre code {
|
||||
.language .aside-title {
|
||||
color: #4183c4; }
|
||||
|
||||
.aside-warning {
|
||||
.aside-warning, .aside-deprecated, .aside-unavailable {
|
||||
border-left: 5px solid #ff6666; }
|
||||
.aside-warning .aside-title {
|
||||
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
|
||||
color: #ff0000; }
|
||||
|
||||
.graybox {
|
||||
@@ -325,6 +346,7 @@ pre code {
|
||||
|
||||
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
|
||||
display: none; }
|
||||
|
||||
html.dash .height-container {
|
||||
display: block; }
|
||||
|
||||
@@ -338,14 +360,17 @@ form[role=search] input {
|
||||
border-radius: 1em; }
|
||||
.loading form[role=search] input {
|
||||
background: white url(../img/spinner.gif) center right 4px no-repeat; }
|
||||
|
||||
form[role=search] .tt-menu {
|
||||
margin: 0;
|
||||
min-width: 300px;
|
||||
background: #fbfbfb;
|
||||
color: #333;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
form[role=search] .tt-highlight {
|
||||
font-weight: bold; }
|
||||
|
||||
form[role=search] .tt-suggestion {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 0 8px; }
|
||||
@@ -358,11 +383,13 @@ form[role=search] .tt-suggestion {
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
padding-left: 16px; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover,
|
||||
form[role=search] .tt-suggestion.tt-cursor {
|
||||
cursor: pointer;
|
||||
background-color: #4183c4;
|
||||
color: #fff; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover .doc-parent-name,
|
||||
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
|
||||
color: #fff; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Enums Reference</title>
|
||||
<title>Enumerations Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
|
||||
|
||||
<a title="Enums Reference"></a>
|
||||
<a title="Enumerations Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -32,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -43,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Enums Reference
|
||||
Enumerations Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,9 +100,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Enums</h1>
|
||||
<p>The following enums are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Enumerations</h1>
|
||||
<p>The following enumerations are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -113,37 +114,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O9SwiftSMTP5Ports"></a>
|
||||
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O9SwiftSMTP5Ports">Ports</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Common <code><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
|
||||
|
||||
<a href="Enums/Ports.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O9SwiftSMTP10AuthMethod"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO"></a>
|
||||
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O9SwiftSMTP10AuthMethod">AuthMethod</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO">AuthMethod</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -159,23 +132,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:O9SwiftSMTP9SMTPError"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO"></a>
|
||||
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:O9SwiftSMTP9SMTPError">SMTPError</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO">SMTPError</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -191,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>
|
||||
@@ -206,8 +175,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>AuthMethod Enum Reference</title>
|
||||
<title>AuthMethod Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
|
||||
|
||||
<a title="AuthMethod Enum Reference"></a>
|
||||
<a title="AuthMethod Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
AuthMethod Enum Reference
|
||||
AuthMethod Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -120,9 +121,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_">cramMD5</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -137,23 +138,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_">login</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -168,23 +165,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_">plain</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -199,23 +192,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_">xoauth2</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -230,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>
|
||||
@@ -245,8 +234,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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,191 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Ports Enum Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
|
||||
|
||||
<a title="Ports Enum Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SwiftSMTP Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
Ports Enum Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Ports</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Common <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/tls" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_">tls</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Default <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">tls</span> <span class="o">=</span> <span class="mi">587</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP5Ports3sslFMS0_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/ssl" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP5Ports3sslFMS0_S0_">ssl</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p><code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> used to connect securely.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">ssl</span> <span class="o">=</span> <span class="mi">465</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SMTPError Enum Reference</title>
|
||||
<title>SMTPError Enumeration Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
|
||||
|
||||
<a title="SMTPError Enum Reference"></a>
|
||||
<a title="SMTPError Enumeration Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SMTPError Enum Reference
|
||||
SMTPError Enumeration Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -120,9 +121,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FT6stringSS_S0_">base64DecodeFail</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/base64DecodeFail(string:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF">base64DecodeFail(string:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -137,23 +138,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_">md5HashChallengeFail</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -168,23 +165,19 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FT4pathSS_S0_">fileNotFound</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/fileNotFound(path:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF">fileNotFound(path:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -199,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:FO9SwiftSMTP9SMTPError23couldNotConnectToServerFMS0_FT6serverSS7timeoutSi_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/couldNotConnectToServer" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError23couldNotConnectToServerFMS0_FT6serverSS7timeoutSi_S0_">couldNotConnectToServer</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">
|
||||
@@ -223,32 +212,26 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Could not connect to server within specified timeout. Ensure your
|
||||
server can connect through <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> 587 or specify which <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> to connect
|
||||
on. Some SMTP servers may require a longer timeout.</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">couldNotConnectToServer</span><span class="p">(</span><span class="nv">server</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">timeout</span><span class="p">:</span> <span class="kt">Int</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:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FT8hostnameSS_S0_">noSupportedAuthMethods</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/noRecipients" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12noRecipientsyA2CmF">noRecipients</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -256,63 +239,26 @@ on. Some SMTP servers may require a longer timeout.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The preferred <code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s could not be found. Connecting with <code><a href="../Structs/SSL.html">SSL</a></code>
|
||||
may be required.</p>
|
||||
<p>Mail has no recipients.</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="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:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/noAccessToken" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError13noAccessTokenFMS0_S0_">noAccessToken</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Attempted to login using <code>XOAUTH2</code> but <code><a href="../Structs/SMTP.html">SMTP</a></code> instance was initialized
|
||||
without an access token.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">noAccessToken</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/createEmailRegexFailed" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22createEmailRegexFailedFMS0_S0_">createEmailRegexFailed</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO22createEmailRegexFailedyA2CmF">createEmailRegexFailed</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -327,23 +273,19 @@ without an access token.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">createEmailRegexFailed</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FT7commandSS8responseSS_S0_">badResponse</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/badResponse(command:response:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11badResponseyACSS_SStcACmF">badResponse(command:<wbr>response:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -358,23 +300,19 @@ without an access token.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">badResponse</span><span class="p">(</span><span class="nv">command</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">response</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FT4dataV10Foundation4Data_S0_">convertDataUTF8Fail</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/convertDataUTF8Fail(data:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO19convertDataUTF8FailyAC10Foundation0E0V_tcACmF">convertDataUTF8Fail(data:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -389,23 +327,19 @@ without an access token.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">convertDataUTF8Fail</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FT5emailSS_S0_">invalidEmail</a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF"></a>
|
||||
<a name="//apple_ref/swift/Element/invalidEmail(email:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12invalidEmailyACSS_tcACmF">invalidEmail(email:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -413,30 +347,53 @@ without an access token.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Invalid email provided for <code><a href="../Structs/User.html">User</a></code>.</p>
|
||||
<p>Invalid email provided for <code>User</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">invalidEmail</span><span class="p">(</span><span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vO9SwiftSMTP9SMTPError11descriptionSS"></a>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF"></a>
|
||||
<a name="//apple_ref/swift/Element/requiredSTARTTLS" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16requiredSTARTTLSyA2CmF">requiredSTARTTLS</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>STARTTLS was required but the server did not request it.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requiredSTARTTLS</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vO9SwiftSMTP9SMTPError11descriptionSS">description</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO11descriptionSSvp">description</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -451,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>
|
||||
@@ -466,8 +423,8 @@ without an access token.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Structs Reference</title>
|
||||
<title>Structures Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
|
||||
|
||||
<a title="Structs Reference"></a>
|
||||
<a title="Structures Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -32,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -43,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Structs Reference
|
||||
Structures Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,9 +100,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Structs</h1>
|
||||
<p>The following structs are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Structures</h1>
|
||||
<p>The following structures are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -113,9 +114,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP10Attachment"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP10Attachment">Attachment</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV">Attachment</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -132,23 +133,20 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Attachment</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Attachment</span><span class="p">:</span> <span class="kt">Equatable</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP4Mail"></a>
|
||||
<a name="/s:9SwiftSMTP4MailV"></a>
|
||||
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP4Mail">Mail</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV">Mail</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -164,23 +162,19 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP4SMTP"></a>
|
||||
<a name="/s:9SwiftSMTP0B0V"></a>
|
||||
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP4SMTP">SMTP</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V">SMTP</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -188,7 +182,7 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
|
||||
<p>Used to connect to an SMTP server and send emails.</p>
|
||||
|
||||
<a href="Structs/SMTP.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
@@ -196,23 +190,19 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP3SSL"></a>
|
||||
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP3SSL">SSL</a>
|
||||
<a name="/s:9SwiftSMTP16TLSConfigurationV"></a>
|
||||
<a name="//apple_ref/swift/Struct/TLSConfiguration" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV">TLSConfiguration</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -220,48 +210,15 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Configuration to connect securely through SSL/TLS.
|
||||
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></p>
|
||||
<p>Configuration for connecting with TLS. For more info, see <a href="https://github.com/Kitura/BlueSSLService">https://github.com/Kitura/BlueSSLService</a>.</p>
|
||||
|
||||
<a href="Structs/SSL.html" class="slightly-smaller">See more</a>
|
||||
<a href="Structs/TLSConfiguration.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:V9SwiftSMTP4User"></a>
|
||||
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:V9SwiftSMTP4User">User</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a sender or receiver of an email.</p>
|
||||
|
||||
<a href="Structs/User.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">TLSConfiguration</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -276,8 +233,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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>
|
||||
|
||||
+101
-70
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Attachment Struct Reference</title>
|
||||
<title>Attachment Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
|
||||
|
||||
<a title="Attachment Struct Reference"></a>
|
||||
<a title="Attachment Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
Attachment Struct Reference
|
||||
Attachment Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -121,9 +123,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(data:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_">init(data:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV4data4mime4name6inline17additionalHeaders18relatedAttachmentsAC10Foundation4DataV_S2SSbSDyS2SGSayACGtcfc">init(data:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -138,12 +140,12 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -160,7 +162,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>Raw data to be sent as attachment.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -173,7 +174,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>MIME type of the data.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -186,7 +186,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>File name which will be presented in the mail.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -198,8 +197,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Indicates if attachment is inline. To embed the attachment in mail content, set to <code>true</code>. To send as standalone attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
|
||||
<p>Indicates if attachment is inline. To embed the attachment
|
||||
in mail content, set to <code>true</code>. To send as standalone
|
||||
attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -211,8 +211,11 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the attachment. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the <code><a href="../Structs/Mail.html">Mail</a></code>. Header keys
|
||||
are capitalized and duplicate keys will
|
||||
overwrite each other. Defaults to none. The
|
||||
following will be ignored: CONTENT-TYPE,
|
||||
CONTENT-DISPOSITION, CONTENT-TRANSFER-ENCODING.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -224,8 +227,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to none.</p>
|
||||
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to
|
||||
none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -238,9 +241,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_">init(filePath:mime:name:inline:additionalHeaders:relatedAttachments:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV8filePath4mime4name6inline17additionalHeaders18relatedAttachmentsACSS_S2SSgSbSDyS2SGSayACGtcfc">init(filePath:<wbr>mime:<wbr>name:<wbr>inline:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -255,12 +258,12 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -277,7 +280,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the local file.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -289,8 +291,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>MIME type of the file. Defaults to <code>application/octet-stream</code>.</p>
|
||||
|
||||
<p>MIME type of the file. Defaults to
|
||||
<code>application/octet-stream</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -302,8 +304,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Name of the file. Defaults to the name component in its file path.</p>
|
||||
|
||||
<p>Name of the file. Defaults to the name component in its
|
||||
file path.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -315,8 +317,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Indicates if attachment is inline. To embed the attachment in mail content, set to <code>true</code>. To send as standalone attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
|
||||
<p>Indicates if attachment is inline. To embed the attachment
|
||||
in mail content, set to <code>true</code>. To send as standalone
|
||||
attachment, set to <code>false</code>. Defaults to <code>false</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -328,8 +331,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the attachment. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the attachment. Header
|
||||
keys are capitalized and duplicate keys will
|
||||
replace each other. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -341,8 +345,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to none.</p>
|
||||
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to
|
||||
none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -355,9 +359,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSaT6headerSS5valueSS__18relatedAttachmentsGSaS0___S0_">init(htmlContent:characterSet:alternative:additionalHeaders:relatedAttachments:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP10AttachmentV11htmlContent12characterSet11alternative17additionalHeaders18relatedAttachmentsACSS_SSSbSDyS2SGSayACGtcfc">init(htmlContent:<wbr>characterSet:<wbr>alternative:<wbr>additionalHeaders:<wbr>relatedAttachments:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -372,11 +376,11 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
|
||||
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span>
|
||||
<span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:],</span>
|
||||
<span class="nv">relatedAttachments</span><span class="p">:</span> <span class="p">[</span><span class="kt">Attachment</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -393,7 +397,6 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
<td>
|
||||
<div>
|
||||
<p>Content string of HTML.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -405,8 +408,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Character encoding of <code>htmlContent</code>. Defaults to <code>utf-8</code>.</p>
|
||||
|
||||
<p>Character encoding of <code>htmlContent</code>. Defaults to
|
||||
<code>utf-8</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -418,8 +421,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Whether the HTML is an alternative for plain text or not. Defaults to <code>true</code>.</p>
|
||||
|
||||
<p>Whether the HTML is an alternative for plain text or
|
||||
not. Defaults to <code>true</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -431,8 +434,9 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the attachment. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the attachment. Header
|
||||
keys are capitalized and duplicate keys will
|
||||
replace each other. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -444,8 +448,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to none.</p>
|
||||
|
||||
<p>Related <code>Attachment</code>s of this attachment. Defaults to
|
||||
none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -455,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">-></span> <span class="kt">Bool</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -463,8 +494,8 @@ Different SMTP servers have different attachment size limits.</p>
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Mail Struct Reference</title>
|
||||
<title>Mail Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
|
||||
|
||||
<a title="Mail Struct Reference"></a>
|
||||
<a title="Mail Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
Mail Struct Reference
|
||||
Mail Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,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>
|
||||
@@ -120,9 +121,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:vV9SwiftSMTP4Mail2idSS"></a>
|
||||
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:vV9SwiftSMTP4Mail2idSS">id</a>
|
||||
<a name="/s:9SwiftSMTP4MailV4uuidSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/uuid" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4uuidSSvp">uuid</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -130,14 +131,14 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>UUID of the <code>Mail</code>.</p>
|
||||
<p>A UUID for the mail.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">id</span> <span class="o">=</span> <span class="kt">UUID</span><span class="p">()</span><span class="o">.</span><span class="n">uuidString</span> <span class="o">+</span> <span class="s">".Swift-SMTP"</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>
|
||||
@@ -147,9 +148,308 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGSaT6headerSS5valueSS___S0_"></a>
|
||||
<a name="/s:9SwiftSMTP4MailV4fromAC4UserVvp"></a>
|
||||
<a name="//apple_ref/swift/Property/from" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4fromAC4UserVvp">from</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV2toSayAC4UserVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/to" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV2toSayAC4UserVGvp">to</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/cc" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV2ccSayAC4UserVGvp">cc</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/bcc" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV3bccSayAC4UserVGvp">bcc</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV7subjectSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/subject" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV7subjectSSvp">subject</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV4textSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/text" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4textSSvp">text</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Text of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">text</span><span class="p">:</span> <span class="kt">String</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/attachments" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV11attachmentsSayAA10AttachmentVGvp">attachments</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are alternatives to plain
|
||||
text, the last one will be used as the alternative (all the <code>Attachments</code> will still be sent). Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp"></a>
|
||||
<a name="//apple_ref/swift/Property/alternative" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV11alternativeAA10AttachmentVSgvp">alternative</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Attachment that is an alternative to plain text.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">alternative</span><span class="p">:</span> <span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp"></a>
|
||||
<a name="//apple_ref/swift/Property/additionalHeaders" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV17additionalHeadersSDyS2SGvp">additionalHeaders</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Additional headers for the <code>Mail</code>. Header keys are capitalized and duplicate keys will overwrite each other.
|
||||
Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION, CONTENT-TRANSFER-ENCODING.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">String</span><span class="p">]</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV2idSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/id" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV2idSSvp">id</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>message-id <a href="https://tools.ietf.org/html/rfc5322#section-3.6.4">https://tools.ietf.org/html/rfc5322#section-3.6.4</a></p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">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>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV8hostnameSSvp"></a>
|
||||
<a name="//apple_ref/swift/Property/hostname" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV8hostnameSSvp">hostname</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Hostname from the email address.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSaS1__3bccGSaS1__7subjectSS4textSS11attachmentsGSaVS_10Attachment_17additionalHeadersGSaT6headerSS5valueSS___S0_">init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc">init(from:<wbr>to:<wbr>cc:<wbr>bcc:<wbr>subject:<wbr>text:<wbr>attachments:<wbr>additionalHeaders:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -164,14 +464,14 @@
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail/User.html">User</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">""</span><span class="p">,</span>
|
||||
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Attachment.html">Attachment</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]</span> <span class="o">=</span> <span class="p">[:])</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,8 +487,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>The <code>User</code> that the <code>Mail</code> will be sent from.</p>
|
||||
|
||||
<p>The <code><a href="../Structs/Mail/User.html">User</a></code> that the <code>Mail</code> will be sent from.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -200,8 +499,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>User</code>s to send the <code>Mail</code> to.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to send the <code>Mail</code> to.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -213,8 +511,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>User</code>s to cc. Defaults to none.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -226,8 +523,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>User</code>s to bcc. Defaults to none.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -240,7 +536,6 @@
|
||||
<td>
|
||||
<div>
|
||||
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -253,7 +548,6 @@
|
||||
<td>
|
||||
<div>
|
||||
<p>Text of the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -265,8 +559,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>Attachment</code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code>Attachment</code>s that are alternatives to to plain text, the last one will be used as the alternative (all the <code>Attachments</code> will still be sent). Defaults to none.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Attachment.html">Attachment</a></code>s for the <code>Mail</code>. If the <code>Mail</code> has multiple <code><a href="../Structs/Attachment.html">Attachment</a></code>s that are
|
||||
alternatives to plain text, the last one will be used as the alternative (all the <code>Attachments</code> will still
|
||||
be sent). Defaults to none.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -278,8 +573,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Additional headers for the <code>Mail</code>. Defaults to none.</p>
|
||||
|
||||
<p>Additional headers for the <code>Mail</code>. Header keys are capitalized and duplicate keys will
|
||||
overwrite each other. Defaults to none. The following will be ignored: CONTENT-TYPE, CONTENT-DISPOSITION,
|
||||
CONTENT-TRANSFER-ENCODING.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -289,6 +585,34 @@
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4MailV4UserV"></a>
|
||||
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV">User</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Represents a sender or receiver of an email.</p>
|
||||
|
||||
<a href="../Structs/Mail/User.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -297,8 +621,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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’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’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’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’s email address.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SMTP Struct Reference</title>
|
||||
<title>SMTP Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
|
||||
|
||||
<a title="SMTP Struct Reference"></a>
|
||||
<a title="SMTP Structure Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -33,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -44,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SMTP Struct Reference
|
||||
SMTP Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
@@ -73,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -100,15 +100,16 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
<h1>SMTP</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
|
||||
<p>Used to connect to an SMTP server and send emails.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -120,9 +121,37 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4SMTPcFT8hostnameSS5emailSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_">init(hostname:email:password:port:ssl:authMethods:domainName:accessToken:timeout:)</a>
|
||||
<a name="/s:9SwiftSMTP0B0V7TLSModeO"></a>
|
||||
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO">TLSMode</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>TLSMode enum for what form of connection security to enforce.</p>
|
||||
|
||||
<a href="../Structs/SMTP/TLSMode.html" class="slightly-smaller">See more</a>
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(hostname:email:password:port:tlsMode:tlsConfiguration:authMethods:domainName:timeout:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V8hostname5email8password4port7tlsMode0G13Configuration11authMethods10domainName7timeoutACSS_S2Ss5Int32VAC7TLSModeOAA16TLSConfigurationVSgSayAA10AuthMethodOGSSSutcfc">init(hostname:<wbr>email:<wbr>password:<wbr>port:<wbr>tlsMode:<wbr>tlsConfiguration:<wbr>authMethods:<wbr>domainName:<wbr>timeout:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -131,18 +160,14 @@
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initializes an <code>SMTP</code> instance.</p>
|
||||
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p>Note:</p>
|
||||
|
||||
<ul>
|
||||
<li>Some servers like Gmail support IPv6, and if your network does
|
||||
not, you will first attempt to connect via IPv6, then timeout, and
|
||||
fall back to IPv4. You can avoid this by disabling IPv6 on your
|
||||
machine.</li>
|
||||
<li>You may need to enable access for less secure apps in your account
|
||||
on the SMTP server.</li>
|
||||
<li>You may need to enable access for less secure apps for your account on the SMTP server.</li>
|
||||
<li>Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
|
||||
IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -152,15 +177,15 @@ on the SMTP server.</li>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">port</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span> <span class="o">=</span> <span class="kt"><a href="../Enums/Ports.html">Ports</a></span><span class="o">.</span><span class="n">tls</span><span class="o">.</span><span class="n">rawValue</span><span class="p">,</span>
|
||||
<span class="nv">ssl</span><span class="p">:</span> <span class="kt"><a href="../Structs/SSL.html">SSL</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
|
||||
<span class="nv">accessToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">Int</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||||
<span class="nv">port</span><span class="p">:</span> <span class="kt">Int32</span> <span class="o">=</span> <span class="mi">587</span><span class="p">,</span>
|
||||
<span class="nv">tlsMode</span><span class="p">:</span> <span class="kt"><a href="../Structs/SMTP/TLSMode.html">TLSMode</a></span> <span class="o">=</span> <span class="o">.</span><span class="n">requireSTARTTLS</span><span class="p">,</span>
|
||||
<span class="nv">tlsConfiguration</span><span class="p">:</span> <span class="kt"><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">authMethods</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="p">]</span> <span class="o">=</span> <span class="p">[],</span>
|
||||
<span class="nv">domainName</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"localhost"</span><span class="p">,</span>
|
||||
<span class="nv">timeout</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="mi">10</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,21 +201,19 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Hostname of the SMTP server to connect to. Should not include any scheme–ie <code>smtp.example.com</code> is valid.</p>
|
||||
|
||||
<p>Hostname of the SMTP server to connect to, i.e. <code>smtp.example.com</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>user</em>
|
||||
<em>email</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Username to log in to server.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -202,8 +225,7 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Password to log in to server.</p>
|
||||
|
||||
<p>Password to log in to server, or access token if using XOAUTH2 authorization method.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -215,21 +237,32 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>Port</code> to connect to the server on. Defaults to <code>587</code>.</p>
|
||||
|
||||
<p>Port to connect to the server on. Defaults to <code>465</code>.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>ssl</em>
|
||||
<em>tlsMode</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>SSL</code> containing configuration info for connecting securely through SSL/TLS. (optional)</p>
|
||||
|
||||
<p>TLSMode <code>enum</code> indicating what form of connection security to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>tlsConfiguration</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> used to connect with TLS. If nil, a configuration with no backing
|
||||
certificates is used. See <code><a href="../Structs/TLSConfiguration.html">TLSConfiguration</a></code> for other configuration options.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -241,8 +274,7 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>AuthMethod</code>s to use to log in to the server. Defaults to <code>CRAM-MD5</code>, <code>LOGIN</code>, and <code>PLAIN</code>.</p>
|
||||
|
||||
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. If blank, tries all supported methods.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -255,20 +287,6 @@ on the SMTP server.</li>
|
||||
<td>
|
||||
<div>
|
||||
<p>Client domain name used when communicating with the server. Defaults to <code>localhost</code>.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>accessToken</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Access token used if logging in through <code>XOAUTH2</code>. (optional)</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -281,7 +299,6 @@ on the SMTP server.</li>
|
||||
<td>
|
||||
<div>
|
||||
<p>How long to try connecting to the server to before returning an error. Defaults to <code>10</code> seconds.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -294,9 +311,9 @@ on the SMTP server.</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_"></a>
|
||||
<a name="/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF"></a>
|
||||
<a name="//apple_ref/swift/Method/send(_:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTVS_4Mail10completionGSqFGSqPs5Error__T___T_">send(_:completion:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V4send_10completionyAA4MailV_ys5Error_pSgcSgtF">send(_:<wbr>completion:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -311,7 +328,7 @@ on the SMTP server.</li>
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-></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">-></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>
|
||||
@@ -327,8 +344,7 @@ on the SMTP server.</li>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>Mail</code> object to send.</p>
|
||||
|
||||
<p><code><a href="../Structs/Mail.html">Mail</a></code> object to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -341,7 +357,6 @@ on the SMTP server.</li>
|
||||
<td>
|
||||
<div>
|
||||
<p>Callback when sending finishes. <code>Error</code> is nil on success. (optional)</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -354,9 +369,9 @@ on the SMTP server.</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_"></a>
|
||||
<a name="/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF"></a>
|
||||
<a name="//apple_ref/swift/Method/send(_:progress:completion:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4SMTP4sendFTGSaVS_4Mail_8progressGSqFTS1_GSqPs5Error___T__10completionGSqFTGSaS1__GSaTS1_PS2_____T___T_">send(_:progress:completion:)</a>
|
||||
<a class="token" href="#/s:9SwiftSMTP0B0V4send_8progress10completionySayAA4MailVG_yAH_s5Error_pSgtcSgyAI_SayAH_sAJ_ptGtcSgtF">send(_:<wbr>progress:<wbr>completion:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -365,21 +380,19 @@ on the SMTP server.</li>
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Send multiple emails.</p>
|
||||
|
||||
<div class="aside aside-note">
|
||||
<p class="aside-title">Note</p>
|
||||
<p>Note:</p>
|
||||
|
||||
<ul>
|
||||
<li>If any of the emails addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>‘s <code>to</code>, <code>cc</code>, or <code>bcc</code>
|
||||
are invalid, the entire mail will not send and return an
|
||||
<code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
|
||||
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s,
|
||||
the whole sending process will not stop until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s
|
||||
are attempted.</li>
|
||||
<li>Each call to <code>send</code> queues it’s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one.
|
||||
To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them in separate calls to
|
||||
<code>send</code>.</li>
|
||||
<li>Each call to <code>send</code> will first log in to your server, attempt to send the mails, then closes the
|
||||
connection. Pass in an array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send them all in one session.</li>
|
||||
<li>If any of the email addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>‘s <code>to</code>, <code>cc</code>, or <code>bcc</code> are invalid, the entire mail will not
|
||||
send and return an <code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
|
||||
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s, the whole sending process will continue
|
||||
until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s are attempted.</li>
|
||||
<li>Each call to <code>send</code> queues it’s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one. To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them
|
||||
in separate calls to <code>send</code>.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
@@ -389,9 +402,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
|
||||
<span class="nv">progress</span><span class="p">:</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">completion</span><span class="p">:</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mails</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">],</span>
|
||||
<span class="nv">progress</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">completion</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a></span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -407,8 +420,7 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Array of <code>Mail</code>s to send.</p>
|
||||
|
||||
<p>Array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -420,8 +432,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>(<code>Mail</code>, <code>Error</code>) callback after each <code>Mail</code> is sent. <code>Mail</code> is the <code>Mail</code> sent and <code>Error</code> is the error if it failed. (optional)</p>
|
||||
|
||||
<p>(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="../Structs/Mail.html">Mail</a></code> is sent. <code><a href="../Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is
|
||||
the error if it failed. (optional)</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -433,8 +445,9 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>([<code>Mail</code>], [(<code>Mail</code>, <code>Error</code>)]) callback after all <code>Mail</code>s have been attempted. [<code>Mail</code>] is an array of successfully sent <code>Mail</code>s. [(<code>Mail</code>, <code>Error</code>)] is an array of failed <code>Mail</code>s and their corresponding <code>Error</code>s. (optional)</p>
|
||||
|
||||
<p>([<code><a href="../Structs/Mail.html">Mail</a></code>], [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="../Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="../Structs/Mail.html">Mail</a></code>] is an
|
||||
array of successfully sent <code><a href="../Structs/Mail.html">Mail</a></code>s. [(<code><a href="../Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="../Structs/Mail.html">Mail</a></code>s and their
|
||||
corresponding <code>Error</code>s. (optional)</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -452,8 +465,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,306 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>SSL Struct Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/SSL" class="dashAnchor"></a>
|
||||
|
||||
<a title="SSL Struct Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SwiftSMTP Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
SSL Struct Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>SSL</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Configuration to connect securely through SSL/TLS.
|
||||
<a href="https://github.com/IBM-Swift/BlueSSLService">https://github.com/IBM-Swift/BlueSSLService</a></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="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withCACertificateFilePath:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withCACertificateDirectory:usingCertificateFile:withKeyFile:usingSelfSignedCerts:cipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withCipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Undocumented</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SSL</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withChainFilePath:withPassword:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP3SSLcFT17withChainFilePathGSqSS_12withPasswordGSqSS_20usingSelfSignedCertsSb11cipherSuiteGSqSS__S0_">init(withChainFilePath:withPassword:usingSelfSignedCerts:cipherSuite:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>Certificate Chain File</code>.</p>
|
||||
|
||||
<p><em>Note:</em> If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject’s certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.</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="n">withChainFilePath</span> <span class="nv">chainFilePath</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">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">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>chainFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the certificate chain file (optional). </p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>password</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Password for the chain file (optional).</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
+510
@@ -0,0 +1,510 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>TLSConfiguration Structure Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<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/TLSConfiguration" class="dashAnchor"></a>
|
||||
|
||||
<a title="TLSConfiguration 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" />
|
||||
TLSConfiguration Structure Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">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>TLSConfiguration</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">TLSConfiguration</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withCipherSuite:clientAllowsSelfSignedCertificates:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP16TLSConfigurationV15withCipherSuite34clientAllowsSelfSignedCertificatesACSSSg_Sbtcfc">init(withCipherSuite:<wbr>clientAllowsSelfSignedCertificates:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration with no backing certificates.</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="n">withCipherSuite</span> <span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>clientAllowsSelfSignedCertificates</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p><code>true</code> to accept self-signed certificates from a server. <code>false</code> otherwise.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<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:9SwiftSMTP16TLSConfigurationV25withCACertificateFilePath016usingCertificateF00d3KeyF00H15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateFilePath:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>CA Certificate</code> file.</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="n">withCACertificateFilePath</span> <span class="nv">caCertificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>caCertificateFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted CA certificate file.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>certificateFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted certificate file.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>keyFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted key file. If nil, <code>certificateFilePath</code> will be used.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<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:9SwiftSMTP16TLSConfigurationV26withCACertificateDirectory20usingCertificateFile0d3KeyI00G15SelfSignedCerts11cipherSuiteACSSSg_A2ISbAItcfc">init(withCACertificateDirectory:<wbr>usingCertificateFile:<wbr>withKeyFile:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>CA Certificate</code> directory.</p>
|
||||
|
||||
<p><em>Note:</em> <code>caCertificateDirPath</code> - All certificates in the specified directory <strong>must</strong> be hashed using the <code>OpenSSL Certificate Tool</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="n">withCACertificateDirectory</span> <span class="nv">caCertificateDirPath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">usingCertificateFile</span> <span class="nv">certificateFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">withKeyFile</span> <span class="nv">keyFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>caCertificateDirPath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to a directory containing CA certificates. <em>(see note above)</em></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>certificateFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted certificate file. If nil, <code>certificateFilePath</code> will be used.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>keyFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the PEM formatted key file (optional). If nil, <code>certificateFilePath</code> is used.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<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:9SwiftSMTP16TLSConfigurationV17withChainFilePath0D8Password20usingSelfSignedCerts012clientAllowsjK12Certificates11cipherSuiteACSSSg_AIS2bAItcfc">init(withChainFilePath:<wbr>withPassword:<wbr>usingSelfSignedCerts:<wbr>clientAllowsSelfSignedCertificates:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>Certificate Chain File</code>.</p>
|
||||
|
||||
<p><em>Note:</em> If using a certificate chain file, the certificates must be in PEM format and must be sorted starting with the subject’s certificate (actual client or server certificate), followed by intermediate CA certificates if applicable, and ending at the highest level (root) CA.</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="n">withChainFilePath</span> <span class="nv">chainFilePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">?,</span>
|
||||
<span class="n">withPassword</span> <span class="nv">password</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||||
<span class="n">usingSelfSignedCerts</span> <span class="nv">selfSigned</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||||
<span class="nv">clientAllowsSelfSignedCertificates</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
|
||||
<span class="nv">cipherSuite</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>chainFilePath</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Path to the certificate chain file (optional). <em>(see note above)</em></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>password</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Password for the chain file (optional). If using self-signed certs, a password is required.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>selfSigned</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>True if certs are <code>self-signed</code>, false otherwise. Defaults to true.</p>
|
||||
</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>
|
||||
<em>cipherSuite</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Optional String containing the cipher suite to use.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/"></a>
|
||||
<a name="//apple_ref/swift/Method/init(withPEMCertificateString:usingSelfSignedCerts:cipherSuite:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/">init(withPEMCertificateString:<wbr>usingSelfSignedCerts:<wbr>cipherSuite:<wbr>)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initialize a configuration using a <code>PEM formatted certificate in String form</code>.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,193 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>User Struct Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
<script src="../js/jquery.min.js" defer></script>
|
||||
<script src="../js/jazzy.js" defer></script>
|
||||
|
||||
<script src="../js/lunr.min.js" defer></script>
|
||||
<script src="../js/typeahead.jquery.js" defer></script>
|
||||
<script src="../js/jazzy.search.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
|
||||
|
||||
<a title="User Struct Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
<a class="header-link" href="../index.html">
|
||||
SwiftSMTP Docs
|
||||
</a>
|
||||
(100% documented)
|
||||
</p>
|
||||
|
||||
<p class="header-col--secondary">
|
||||
<form role="search" action="../search.json">
|
||||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||||
</form>
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<img class="header-icon" src="../img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</header>
|
||||
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="../img/carat.png" />
|
||||
User Struct Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP6Header">Header</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>User</h1>
|
||||
<div class="declaration">
|
||||
<div class="language">
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<p>Represents a sender or receiver of an email.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="task-group">
|
||||
<ul class="item-container">
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_"></a>
|
||||
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_">init(name:email:)</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
<div class="pointer-container"></div>
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Initializes a <code>User</code>.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Parameters</h4>
|
||||
<table class="graybox">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>name</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Display name for the user. (optional)</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<code>
|
||||
<em>email</em>
|
||||
</code>
|
||||
</td>
|
||||
<td>
|
||||
<div>
|
||||
<p>Email address for the user.</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Typealiases Reference</title>
|
||||
<title>Type Aliases Reference</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
|
||||
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
|
||||
<meta charset="utf-8">
|
||||
@@ -14,8 +14,9 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
|
||||
|
||||
<a title="Typealiases Reference"></a>
|
||||
<a title="Type Aliases Reference"></a>
|
||||
|
||||
<header class="header">
|
||||
<p class="header-col header-col--primary">
|
||||
@@ -32,7 +33,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -43,28 +44,25 @@
|
||||
<p class="breadcrumbs">
|
||||
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
|
||||
<img class="carat" src="img/carat.png" />
|
||||
Typealiases Reference
|
||||
Type Aliases Reference
|
||||
</p>
|
||||
|
||||
<div class="content-wrapper">
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +70,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,9 +100,9 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<h1>Typealiases</h1>
|
||||
<p>The following typealiases are available globally.</p>
|
||||
<div class="section-content top-matter">
|
||||
<h1>Type Aliases</h1>
|
||||
<p>The following type aliases are available globally.</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -113,9 +114,9 @@
|
||||
<li class="item">
|
||||
<div>
|
||||
<code>
|
||||
<a name="/s:9SwiftSMTP4Port"></a>
|
||||
<a name="//apple_ref/swift/Alias/Port" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP4Port">Port</a>
|
||||
<a name="/s:9SwiftSMTP8Progressa"></a>
|
||||
<a name="//apple_ref/swift/Alias/Progress" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</code>
|
||||
</div>
|
||||
<div class="height-container">
|
||||
@@ -123,30 +124,26 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Port to connect to SMTP server with.</p>
|
||||
<p>(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="Structs/Mail.html">Mail</a></code> is sent. <code><a href="Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is the error if it failed.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Port</span> <span class="o">=</span> <span class="kt">Int32</span></code></pre>
|
||||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="p">((</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-></span> <span class="kt">Void</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:9SwiftSMTP6Header"></a>
|
||||
<a name="//apple_ref/swift/Alias/Header" class="dashAnchor"></a>
|
||||
<a class="token" href="#/s:9SwiftSMTP6Header">Header</a>
|
||||
<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">
|
||||
@@ -154,14 +151,15 @@
|
||||
<section class="section">
|
||||
<div class="pointer"></div>
|
||||
<div class="abstract">
|
||||
<p>Custom header for a <code><a href="Structs/Mail.html">Mail</a></code> or <code><a href="Structs/Attachment.html">Attachment</a></code>.</p>
|
||||
<p>([<code><a href="Structs/Mail.html">Mail</a></code>], [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="Structs/Mail.html">Mail</a></code>] is an array of successfully
|
||||
sent <code><a href="Structs/Mail.html">Mail</a></code>s. [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="Structs/Mail.html">Mail</a></code>s and their corresponding <code>Error</code>s.</p>
|
||||
|
||||
</div>
|
||||
<div class="declaration">
|
||||
<h4>Declaration</h4>
|
||||
<div class="language">
|
||||
<p class="aside-title">Swift</p>
|
||||
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Header</span> <span class="o">=</span> <span class="p">(</span><span class="nv">header</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">value</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="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">-></span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,8 +174,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
</section>
|
||||
</body>
|
||||
</div>
|
||||
|
||||
@@ -63,6 +63,10 @@ a {
|
||||
a:hover, a:focus {
|
||||
outline: 0;
|
||||
text-decoration: underline; }
|
||||
a.discouraged {
|
||||
text-decoration: line-through; }
|
||||
a.discouraged:hover, a.discouraged:focus {
|
||||
text-decoration: underline line-through; }
|
||||
|
||||
table {
|
||||
background: #fff;
|
||||
@@ -90,10 +94,10 @@ pre {
|
||||
code {
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
|
||||
|
||||
p > code, li > code {
|
||||
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
|
||||
background: #f7f7f7;
|
||||
padding: .2em; }
|
||||
p > code:before, p > code:after, li > code:before, li > code:after {
|
||||
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
|
||||
letter-spacing: -.2em;
|
||||
content: "\00a0"; }
|
||||
|
||||
@@ -107,7 +111,6 @@ pre code {
|
||||
@media (min-width: 768px) {
|
||||
.content-wrapper {
|
||||
flex-direction: row; } }
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
padding: 8px;
|
||||
@@ -153,7 +156,6 @@ pre code {
|
||||
word-wrap: normal;
|
||||
background: #fbfbfb;
|
||||
border-right: 1px solid #ddd; } }
|
||||
|
||||
.nav-groups {
|
||||
list-style-type: none;
|
||||
padding-left: 0; }
|
||||
@@ -184,7 +186,6 @@ pre code {
|
||||
order: 2;
|
||||
flex: 1;
|
||||
padding-bottom: 60px; } }
|
||||
|
||||
.section {
|
||||
padding: 0 32px;
|
||||
border-bottom: 1px solid #ddd; }
|
||||
@@ -197,6 +198,8 @@ pre code {
|
||||
.section-name {
|
||||
color: #666;
|
||||
display: block; }
|
||||
.section-name p {
|
||||
margin-bottom: inherit; }
|
||||
|
||||
.declaration .highlight {
|
||||
overflow-x: initial;
|
||||
@@ -215,6 +218,22 @@ pre code {
|
||||
content: "";
|
||||
display: block; }
|
||||
|
||||
.section-name-container {
|
||||
position: relative; }
|
||||
.section-name-container .section-name-link {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 0; }
|
||||
.section-name-container .section-name {
|
||||
position: relative;
|
||||
pointer-events: none;
|
||||
z-index: 1; }
|
||||
.section-name-container .section-name a {
|
||||
pointer-events: auto; }
|
||||
|
||||
.item-container {
|
||||
padding: 0; }
|
||||
|
||||
@@ -225,9 +244,11 @@ pre code {
|
||||
.item a[name]:before {
|
||||
content: "";
|
||||
display: block; }
|
||||
.item .token {
|
||||
.item .token, .item .direct-link {
|
||||
display: inline-block;
|
||||
text-indent: -20px;
|
||||
padding-left: 3px;
|
||||
margin-left: 0px;
|
||||
margin-left: 20px;
|
||||
font-size: 1rem; }
|
||||
.item .declaration-note {
|
||||
font-size: .85em;
|
||||
@@ -287,9 +308,9 @@ pre code {
|
||||
.language .aside-title {
|
||||
color: #4183c4; }
|
||||
|
||||
.aside-warning {
|
||||
.aside-warning, .aside-deprecated, .aside-unavailable {
|
||||
border-left: 5px solid #ff6666; }
|
||||
.aside-warning .aside-title {
|
||||
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
|
||||
color: #ff0000; }
|
||||
|
||||
.graybox {
|
||||
@@ -325,6 +346,7 @@ pre code {
|
||||
|
||||
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
|
||||
display: none; }
|
||||
|
||||
html.dash .height-container {
|
||||
display: block; }
|
||||
|
||||
@@ -338,14 +360,17 @@ form[role=search] input {
|
||||
border-radius: 1em; }
|
||||
.loading form[role=search] input {
|
||||
background: white url(../img/spinner.gif) center right 4px no-repeat; }
|
||||
|
||||
form[role=search] .tt-menu {
|
||||
margin: 0;
|
||||
min-width: 300px;
|
||||
background: #fbfbfb;
|
||||
color: #333;
|
||||
border: 1px solid #ddd; }
|
||||
|
||||
form[role=search] .tt-highlight {
|
||||
font-weight: bold; }
|
||||
|
||||
form[role=search] .tt-suggestion {
|
||||
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 0 8px; }
|
||||
@@ -358,11 +383,13 @@ form[role=search] .tt-suggestion {
|
||||
font-weight: normal;
|
||||
font-size: 0.9em;
|
||||
padding-left: 16px; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover,
|
||||
form[role=search] .tt-suggestion.tt-cursor {
|
||||
cursor: pointer;
|
||||
background-color: #4183c4;
|
||||
color: #fff; }
|
||||
|
||||
form[role=search] .tt-suggestion:hover .doc-parent-name,
|
||||
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
|
||||
color: #fff; }
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</p>
|
||||
|
||||
<p class="header-col header-col--secondary">
|
||||
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
|
||||
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
|
||||
<img class="header-icon" src="img/gh.png"/>
|
||||
View on GitHub
|
||||
</a>
|
||||
@@ -50,21 +50,18 @@
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +69,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,123 +99,169 @@
|
||||
<article class="main-content">
|
||||
|
||||
<section class="section">
|
||||
<div class="section-content">
|
||||
<div class="section-content top-matter">
|
||||
|
||||
<a href='#swift-smtp' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='swift-smtp'>Swift-SMTP</h1>
|
||||
<h1 id='swift-smtp' class='heading'>Swift-SMTP</h1>
|
||||
|
||||
<p><img src="https://github.com/IBM-Swift/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png" alt="Swift-SMTP bird"></p>
|
||||
<p><img src="https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true" alt="Swift-SMTP bird"></p>
|
||||
|
||||
<p>Swift package for sending emails to an SMTP server.</p>
|
||||
<p>Swift SMTP client.</p>
|
||||
|
||||
<p><a href="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master"><img src="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master" alt="Build Status - Master"></a>
|
||||
<p><img src="https://travis-ci.org/Kitura/Swift-SMTP.svg?branch=master" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/os-macOS-green.svg?style=flat" alt="macOS">
|
||||
<img src="https://img.shields.io/badge/os-linux-green.svg?style=flat" alt="Linux">
|
||||
<img src="https://img.shields.io/badge/license-Apache2-blue.svg?style=flat" alt="Apache 2"></p>
|
||||
<a href='#features' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='features'>Features</h2>
|
||||
<h2 id='features' class='heading'>Features</h2>
|
||||
|
||||
<ul>
|
||||
<li>Connect securely through SSL/TLS if available</li>
|
||||
<li>Connect securely through SSL/TLS when needed</li>
|
||||
<li>Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2</li>
|
||||
<li>Send emails with local file, HTML, and raw data attachments</li>
|
||||
<li>Add custom headers</li>
|
||||
<li>Asynchronous</li>
|
||||
<li><a href="https://ibm-swift.github.io/Swift-SMTP/">Documentation</a></li>
|
||||
<li><a href="https://developer.ibm.com/swift/2017/05/31/4675/">Demo & blog post</a></li>
|
||||
<li><a href="https://kitura.github.io/Swift-SMTP/">Documentation</a></li>
|
||||
</ul>
|
||||
<a href='#swift-version' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='swift-version'>Swift Version</h2>
|
||||
<h2 id='swift-version' class='heading'>Swift Version</h2>
|
||||
|
||||
<p>macOS & Linux: <code>Swift 3.1.1</code></p>
|
||||
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
|
||||
<p>macOS & 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>Use the <code>SMTP</code> struct as a handle to your SMTP server. If your server requires a SSL/TLS connection, you can specify an <code>SSL</code> config and include it in your <code>SMTP</code> handle:</p>
|
||||
<p>You can add <code>SwiftSMTP</code> to your project using <a href="https://swift.org/package-manager/">Swift Package Manager</a>. If your project does not have a <code>Package.swift</code> file, create one by running <code>swift package init</code> in the root directory of your project. Then open <code>Package.swift</code> and add <code>SwiftSMTP</code> as a dependency. Be sure to add it to your desired targets as well:</p>
|
||||
<pre class="highlight swift"><code><span class="c1">// swift-tools-version:4.0</span>
|
||||
|
||||
<span class="kd">import</span> <span class="kt">PackageDescription</span>
|
||||
|
||||
<span class="k">let</span> <span class="nv">package</span> <span class="o">=</span> <span class="kt">Package</span><span class="p">(</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
|
||||
<span class="nv">products</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="o">.</span><span class="nf">library</span><span class="p">(</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
|
||||
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
|
||||
<span class="p">],</span>
|
||||
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/Kitura/Swift-SMTP"</span><span class="p">,</span> <span class="o">.</span><span class="nf">upToNextMinor</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="s">"5.1.0"</span><span class="p">)),</span> <span class="c1">// add the dependency</span>
|
||||
<span class="p">],</span>
|
||||
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="o">.</span><span class="nf">target</span><span class="p">(</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
|
||||
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"SwiftSMTP"</span><span class="p">]),</span> <span class="c1">// add targets</span>
|
||||
<span class="o">.</span><span class="nf">testTarget</span><span class="p">(</span> <span class="c1">// note "SwiftSMTP" (NO HYPHEN)</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProjectTests"</span><span class="p">,</span>
|
||||
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
|
||||
<span class="p">]</span>
|
||||
<span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<p>After adding the dependency and saving, run <code>swift package generate-xcodeproj</code> in the root directory of your project. This will fetch dependencies and create an Xcode project which you can open and begin editing.</p>
|
||||
<h2 id='migration-guide' class='heading'>Migration Guide</h2>
|
||||
|
||||
<p>Version <code>5.0.0</code> brings breaking changes. See the quick migration guide <a href="https://github.com/Kitura/Swift-SMTP/blob/master/migration-guide.md">here</a>.</p>
|
||||
<h2 id='usage' class='heading'>Usage</h2>
|
||||
|
||||
<p>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 an `SSL` config</span>
|
||||
<span class="cp">#if os(Linux)</span>
|
||||
<span class="k">let</span> <span class="nv">certificateFilePath</span> <span class="o">=</span> <span class="s">"~/cert.pem"</span>
|
||||
<span class="k">let</span> <span class="nv">keyFilePath</span> <span class="o">=</span> <span class="s">"~/key.pem"</span>
|
||||
<span class="k">let</span> <span class="nv">ssl</span> <span class="o">=</span> <span class="kt">SSL</span><span class="p">(</span><span class="nv">withCACertificateDirectory</span><span class="p">:</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">usingCertificateFile</span><span class="p">:</span> <span class="n">certificateFilePath</span><span class="p">,</span> <span class="nv">withKeyFile</span><span class="p">:</span> <span class="n">keyFilePath</span><span class="p">)</span>
|
||||
<span class="cp">#else</span>
|
||||
<span class="k">let</span> <span class="nv">chainFilePath</span> <span class="o">=</span> <span class="s">"~/cert.pfx"</span>
|
||||
<span class="k">let</span> <span class="nv">certPassword</span> <span class="o">=</span> <span class="s">"password"</span>
|
||||
<span class="k">let</span> <span class="nv">ssl</span> <span class="o">=</span> <span class="kt">SSL</span><span class="p">(</span><span class="nv">withChainFilePath</span><span class="p">:</span> <span class="n">chainFilePath</span><span class="p">,</span> <span class="nv">withPassword</span><span class="p">:</span> <span class="n">certPassword</span><span class="p">)</span>
|
||||
<span class="cp">#endif</span>
|
||||
<span class="cm">/* Additional methods available to create an `SSL` config */</span>
|
||||
|
||||
<span class="c1">// Create your `SMTP` handle</span>
|
||||
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
|
||||
<span class="nv">user</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login </span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span><span class="p">,</span> <span class="c1">// password to login</span>
|
||||
<span class="nv">ssl</span><span class="p">:</span> <span class="n">ssl</span><span class="p">)</span> <span class="c1">// if your SMTP server requires SSL/TLS</span>
|
||||
|
||||
<span class="cm">/* Additional parameters available to further customize your `SMTP` handle */</span>
|
||||
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span>
|
||||
<span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
|
||||
<span class="nv">email</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login</span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span> <span class="c1">// password to login</span>
|
||||
<span class="p">)</span>
|
||||
</code></pre>
|
||||
<a href='#send-email' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='send-email'>Send email</h3>
|
||||
<h3 id='tls' class='heading'>TLS</h3>
|
||||
|
||||
<p>Create a <code>Mail</code> object and use your <code>smtp</code> handle to send it. To set the sender and receiver of an email, use the <code>User</code> struct:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">drLight</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Dr. Light"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"drlight@gmail.com"</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">megaman</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Megaman"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"megaman@gmail.com"</span><span class="p">)</span>
|
||||
<p>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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">err</span><span class="p">)</span> <span class="k">in</span>
|
||||
<span class="k">if</span> <span class="k">let</span> <span class="nv">err</span> <span class="o">=</span> <span class="n">err</span> <span class="p">{</span>
|
||||
<span class="nf">print</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
|
||||
<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="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">error</span><span class="p">)</span> <span class="k">in</span>
|
||||
<span class="k">if</span> <span class="k">let</span> <span class="nv">error</span> <span class="o">=</span> <span class="n">error</span> <span class="p">{</span>
|
||||
<span class="nf">print</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Add Cc and Bcc:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
|
||||
<span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span>
|
||||
<span class="p">)</span>
|
||||
|
||||
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
<a href='#send-attachments' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='send-attachments'>Send attachments</h3>
|
||||
<h3 id='send-attachments' class='heading'>Send attachments</h3>
|
||||
|
||||
<p>Create an <code>Attachment</code>, attach it to your <code>Mail</code>, and send it through the <code>smtp</code> handle. Here’s an example of how you can send the three supported types of attachments–a local file, HTML, and raw data:</p>
|
||||
<p>Create an <code><a href="Structs/Attachment.html">Attachment</a></code>, attach it to your <code><a href="Structs/Mail.html">Mail</a></code>, and send it through the <code><a href="Structs/SMTP.html">SMTP</a></code> handle. Here’s an example of how you can send the three supported types of attachments–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">"<html>Here's an image: <img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/></html>"</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">"<html>Here's an image: <img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/></html>"</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>
|
||||
|
||||
<span class="cm">/* Each type of attachment has additional parameters for further customization */</span>
|
||||
</code></pre>
|
||||
<a href='#send-multiple-mails' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='send-multiple-mails'>Send multiple mails</h3>
|
||||
<h3 id='send-multiple-mails' class='heading'>Send multiple mails</h3>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mail1</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
|
||||
<span class="k">let</span> <span class="nv">mail2</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
|
||||
|
||||
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">([</span><span class="n">mail1</span><span class="p">,</span> <span class="n">mail2</span><span class="p">],</span>
|
||||
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">([</span><span class="n">mail1</span><span class="p">,</span> <span class="n">mail2</span><span class="p">],</span>
|
||||
<span class="c1">// This optional callback gets called after each `Mail` is sent.</span>
|
||||
<span class="c1">// `mail` is the attempted `Mail`, `error` is the error if one occured.</span>
|
||||
<span class="nv">progress</span><span class="p">:</span> <span class="p">{</span> <span class="p">(</span><span class="n">mail</span><span class="p">,</span> <span class="n">error</span><span class="p">)</span> <span class="k">in</span>
|
||||
@@ -228,12 +274,12 @@
|
||||
<span class="p">}</span>
|
||||
<span class="p">)</span>
|
||||
</code></pre>
|
||||
<a href='#acknowledgements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='acknowledgements'>Acknowledgements</h2>
|
||||
<h2 id='acknowledgements' class='heading'>Acknowledgements</h2>
|
||||
|
||||
<p><code>Swift-SMTP</code> was inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>, two Swift packages that can also be used to send emails to an SMTP server.</p>
|
||||
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2>
|
||||
<p>Inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>.</p>
|
||||
<h2 id='license' class='heading'>License</h2>
|
||||
|
||||
<p>Apache 2.0</p>
|
||||
<p>Apache v2.0</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -242,8 +288,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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;
|
||||
|
||||
Vendored
Executable → Regular
+2
-4
File diff suppressed because one or more lines are too long
Vendored
Executable → Regular
+3
-3
File diff suppressed because one or more lines are too long
+209
-53
@@ -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
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"warnings": [
|
||||
|
||||
],
|
||||
"source_directory": "/Users/quanvo/Projects/Swift-SMTP"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+136
-88
@@ -7,7 +7,7 @@
|
||||
<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>
|
||||
@@ -24,20 +24,20 @@
|
||||
</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/">
|
||||
<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">
|
||||
@@ -50,21 +50,18 @@
|
||||
<nav class="navigation">
|
||||
<ul class="nav-groups">
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Enums.html">Enums</a>
|
||||
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Structs.html">Structs</a>
|
||||
<a class="nav-group-name-link" href="Structs.html">Structures</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
|
||||
@@ -72,25 +69,28 @@
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/Mail/User.html">– User</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
|
||||
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html">– TLSMode</a>
|
||||
</li>
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Structs/User.html">User</a>
|
||||
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-group-name">
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
|
||||
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
|
||||
<ul class="nav-group-tasks">
|
||||
<li class="nav-group-task">
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP6Header">Header</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:9SwiftSMTP4Port">Port</a>
|
||||
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -99,117 +99,165 @@
|
||||
<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>
|
||||
|
||||
<a href='#swift-smtp' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='swift-smtp'>Swift-SMTP</h1>
|
||||
<p><img src="https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true" alt="Swift-SMTP bird"></p>
|
||||
|
||||
<p>Swift package for sending emails to an SMTP server.</p>
|
||||
<p>Swift SMTP client.</p>
|
||||
|
||||
<p><a href="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master"><img src="https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master" alt="Build Status - Master"></a>
|
||||
<p><img src="https://travis-ci.org/Kitura/Swift-SMTP.svg?branch=master" alt="Build Status">
|
||||
<img src="https://img.shields.io/badge/os-macOS-green.svg?style=flat" alt="macOS">
|
||||
<img src="https://img.shields.io/badge/os-linux-green.svg?style=flat" alt="Linux">
|
||||
<img src="https://img.shields.io/badge/license-Apache2-blue.svg?style=flat" alt="Apache 2"></p>
|
||||
<a href='#features' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='features'>Features</h2>
|
||||
<h2 id='features' class='heading'>Features</h2>
|
||||
|
||||
<ul>
|
||||
<li>Connect securely through SSL/TLS if available</li>
|
||||
<li>Connect securely through SSL/TLS when needed</li>
|
||||
<li>Authenticate with CRAM-MD5, LOGIN, PLAIN, or XOAUTH2</li>
|
||||
<li>Send emails with local file, HTML, and raw data attachments</li>
|
||||
<li>Add custom headers</li>
|
||||
<li>Asynchronous</li>
|
||||
<li><a href="https://ibm-swift.github.io/Swift-SMTP/">Documentation</a></li>
|
||||
<li><a href="https://developer.ibm.com/swift/2017/05/31/4675/">Demo & blog post</a></li>
|
||||
<li><a href="https://kitura.github.io/Swift-SMTP/">Documentation</a></li>
|
||||
</ul>
|
||||
<a href='#swift-version' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='swift-version'>Swift Version</h2>
|
||||
<h2 id='swift-version' class='heading'>Swift Version</h2>
|
||||
|
||||
<p>macOS & Linux: <code>Swift 3.1.1</code></p>
|
||||
<a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2>
|
||||
<p>macOS & 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>Use the <code>SMTP</code> struct as a handle to your SMTP server. If your server requires a SSL/TLS connection, you can specify an <code>SSL</code> config and include it in your <code>SMTP</code> handle:</p>
|
||||
<p>You can add <code>SwiftSMTP</code> to your project using <a href="https://swift.org/package-manager/">Swift Package Manager</a>. If your project does not have a <code>Package.swift</code> file, create one by running <code>swift package init</code> in the root directory of your project. Then open <code>Package.swift</code> and add <code>SwiftSMTP</code> as a dependency. Be sure to add it to your desired targets as well:</p>
|
||||
<pre class="highlight swift"><code><span class="c1">// swift-tools-version:4.0</span>
|
||||
|
||||
<span class="kd">import</span> <span class="kt">PackageDescription</span>
|
||||
|
||||
<span class="k">let</span> <span class="nv">package</span> <span class="o">=</span> <span class="kt">Package</span><span class="p">(</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
|
||||
<span class="nv">products</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="o">.</span><span class="nf">library</span><span class="p">(</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
|
||||
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
|
||||
<span class="p">],</span>
|
||||
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="o">.</span><span class="nf">package</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="s">"https://github.com/Kitura/Swift-SMTP"</span><span class="p">,</span> <span class="o">.</span><span class="nf">upToNextMinor</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="s">"5.1.0"</span><span class="p">)),</span> <span class="c1">// add the dependency</span>
|
||||
<span class="p">],</span>
|
||||
<span class="nv">targets</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="o">.</span><span class="nf">target</span><span class="p">(</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProject"</span><span class="p">,</span>
|
||||
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"SwiftSMTP"</span><span class="p">]),</span> <span class="c1">// add targets</span>
|
||||
<span class="o">.</span><span class="nf">testTarget</span><span class="p">(</span> <span class="c1">// note "SwiftSMTP" (NO HYPHEN)</span>
|
||||
<span class="nv">name</span><span class="p">:</span> <span class="s">"MyProjectTests"</span><span class="p">,</span>
|
||||
<span class="nv">dependencies</span><span class="p">:</span> <span class="p">[</span><span class="s">"MyProject"</span><span class="p">]),</span>
|
||||
<span class="p">]</span>
|
||||
<span class="p">)</span>
|
||||
</code></pre>
|
||||
|
||||
<p>After adding the dependency and saving, run <code>swift package generate-xcodeproj</code> in the root directory of your project. This will fetch dependencies and create an Xcode project which you can open and begin editing.</p>
|
||||
<h2 id='migration-guide' class='heading'>Migration Guide</h2>
|
||||
|
||||
<p>Version <code>5.0.0</code> brings breaking changes. See the quick migration guide <a href="https://github.com/Kitura/Swift-SMTP/blob/master/migration-guide.md">here</a>.</p>
|
||||
<h2 id='usage' class='heading'>Usage</h2>
|
||||
|
||||
<p>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 an `SSL` config</span>
|
||||
<span class="cp">#if os(Linux)</span>
|
||||
<span class="k">let</span> <span class="nv">certificateFilePath</span> <span class="o">=</span> <span class="s">"~/cert.pem"</span>
|
||||
<span class="k">let</span> <span class="nv">keyFilePath</span> <span class="o">=</span> <span class="s">"~/key.pem"</span>
|
||||
<span class="k">let</span> <span class="nv">ssl</span> <span class="o">=</span> <span class="kt">SSL</span><span class="p">(</span><span class="nv">withCACertificateDirectory</span><span class="p">:</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">usingCertificateFile</span><span class="p">:</span> <span class="n">certificateFilePath</span><span class="p">,</span> <span class="nv">withKeyFile</span><span class="p">:</span> <span class="n">keyFilePath</span><span class="p">)</span>
|
||||
<span class="cp">#else</span>
|
||||
<span class="k">let</span> <span class="nv">chainFilePath</span> <span class="o">=</span> <span class="s">"~/cert.pfx"</span>
|
||||
<span class="k">let</span> <span class="nv">certPassword</span> <span class="o">=</span> <span class="s">"password"</span>
|
||||
<span class="k">let</span> <span class="nv">ssl</span> <span class="o">=</span> <span class="kt">SSL</span><span class="p">(</span><span class="nv">withChainFilePath</span><span class="p">:</span> <span class="n">chainFilePath</span><span class="p">,</span> <span class="nv">withPassword</span><span class="p">:</span> <span class="n">certPassword</span><span class="p">)</span>
|
||||
<span class="cp">#endif</span>
|
||||
<span class="cm">/* Additional methods available to create an `SSL` config */</span>
|
||||
|
||||
<span class="c1">// Create your `SMTP` handle</span>
|
||||
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span><span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
|
||||
<span class="nv">user</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login </span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span><span class="p">,</span> <span class="c1">// password to login</span>
|
||||
<span class="nv">ssl</span><span class="p">:</span> <span class="n">ssl</span><span class="p">)</span> <span class="c1">// if your SMTP server requires SSL/TLS</span>
|
||||
|
||||
<span class="cm">/* Additional parameters available to further customize your `SMTP` handle */</span>
|
||||
<span class="k">let</span> <span class="nv">smtp</span> <span class="o">=</span> <span class="kt">SMTP</span><span class="p">(</span>
|
||||
<span class="nv">hostname</span><span class="p">:</span> <span class="s">"smtp.gmail.com"</span><span class="p">,</span> <span class="c1">// SMTP server address</span>
|
||||
<span class="nv">email</span><span class="p">:</span> <span class="s">"user@gmail.com"</span><span class="p">,</span> <span class="c1">// username to login</span>
|
||||
<span class="nv">password</span><span class="p">:</span> <span class="s">"password"</span> <span class="c1">// password to login</span>
|
||||
<span class="p">)</span>
|
||||
</code></pre>
|
||||
<a href='#send-email' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='send-email'>Send email</h3>
|
||||
<h3 id='tls' class='heading'>TLS</h3>
|
||||
|
||||
<p>Create a <code>Mail</code> object and use your <code>smtp</code> handle to send it. To set the sender and receiver of an email, use the <code>User</code> struct:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">drLight</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Dr. Light"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"drlight@gmail.com"</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">megaman</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Megaman"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"megaman@gmail.com"</span><span class="p">)</span>
|
||||
<p>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>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">err</span><span class="p">)</span> <span class="k">in</span>
|
||||
<span class="k">if</span> <span class="k">let</span> <span class="nv">err</span> <span class="o">=</span> <span class="n">err</span> <span class="p">{</span>
|
||||
<span class="nf">print</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
|
||||
<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="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span> <span class="p">{</span> <span class="p">(</span><span class="n">error</span><span class="p">)</span> <span class="k">in</span>
|
||||
<span class="k">if</span> <span class="k">let</span> <span class="nv">error</span> <span class="o">=</span> <span class="n">error</span> <span class="p">{</span>
|
||||
<span class="nf">print</span><span class="p">(</span><span class="n">error</span><span class="p">)</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</code></pre>
|
||||
|
||||
<p>Add Cc and Bcc:</p>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">roll</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Roll"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"roll@gmail.com"</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">zero</span> <span class="o">=</span> <span class="kt">Mail</span><span class="o">.</span><span class="kt">User</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="s">"Zero"</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="s">"zero@gmail.com"</span><span class="p">)</span>
|
||||
|
||||
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span><span class="p">)</span>
|
||||
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
|
||||
<span class="nv">from</span><span class="p">:</span> <span class="n">drLight</span><span class="p">,</span>
|
||||
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">megaman</span><span class="p">],</span>
|
||||
<span class="nv">cc</span><span class="p">:</span> <span class="p">[</span><span class="n">roll</span><span class="p">],</span>
|
||||
<span class="nv">bcc</span><span class="p">:</span> <span class="p">[</span><span class="n">zero</span><span class="p">],</span>
|
||||
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Robots should be used for the betterment of mankind."</span><span class="p">,</span>
|
||||
<span class="nv">text</span><span class="p">:</span> <span class="s">"Any other use would be...unethical."</span>
|
||||
<span class="p">)</span>
|
||||
|
||||
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
|
||||
</code></pre>
|
||||
<a href='#send-attachments' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='send-attachments'>Send attachments</h3>
|
||||
<h3 id='send-attachments' class='heading'>Send attachments</h3>
|
||||
|
||||
<p>Create an <code>Attachment</code>, attach it to your <code>Mail</code>, and send it through the <code>smtp</code> handle. Here’s an example of how you can send the three supported types of attachments–a local file, HTML, and raw data:</p>
|
||||
<p>Create an <code><a href="Structs/Attachment.html">Attachment</a></code>, attach it to your <code><a href="Structs/Mail.html">Mail</a></code>, and send it through the <code><a href="Structs/SMTP.html">SMTP</a></code> handle. Here’s an example of how you can send the three supported types of attachments–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">"<html>Here's an image: <img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/></html>"</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">"<html>Here's an image: <img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/></html>"</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>
|
||||
|
||||
<span class="cm">/* Each type of attachment has additional parameters for further customization */</span>
|
||||
</code></pre>
|
||||
<a href='#send-multiple-mails' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h3 id='send-multiple-mails'>Send multiple mails</h3>
|
||||
<h3 id='send-multiple-mails' class='heading'>Send multiple mails</h3>
|
||||
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mail1</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
|
||||
<span class="k">let</span> <span class="nv">mail2</span><span class="p">:</span> <span class="kt">Mail</span> <span class="o">=</span> <span class="c1">//...</span>
|
||||
|
||||
@@ -226,12 +274,12 @@
|
||||
<span class="p">}</span>
|
||||
<span class="p">)</span>
|
||||
</code></pre>
|
||||
<a href='#acknowledgements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='acknowledgements'>Acknowledgements</h2>
|
||||
<h2 id='acknowledgements' class='heading'>Acknowledgements</h2>
|
||||
|
||||
<p><code>Swift-SMTP</code> was inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>, two Swift packages that can also be used to send emails to an SMTP server.</p>
|
||||
<a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2>
|
||||
<p>Inspired by <a href="https://github.com/onevcat/Hedwig">Hedwig</a> and <a href="https://github.com/PerfectlySoft/Perfect-SMTP">Perfect-SMTP</a>.</p>
|
||||
<h2 id='license' class='heading'>License</h2>
|
||||
|
||||
<p>Apache 2.0</p>
|
||||
<p>Apache v2.0</p>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
@@ -240,8 +288,8 @@
|
||||
</article>
|
||||
</div>
|
||||
<section class="footer">
|
||||
<p>© 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-06-07)</p>
|
||||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.5</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
||||
<p>© 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
@@ -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
@@ -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;
|
||||
|
||||
+2
-4
File diff suppressed because one or more lines are too long
+3
-3
File diff suppressed because one or more lines are too long
+209
-53
@@ -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
File diff suppressed because one or more lines are too long
@@ -2,5 +2,5 @@
|
||||
"warnings": [
|
||||
|
||||
],
|
||||
"source_directory": "/Users/quanvo/Projects/Swift-SMTP"
|
||||
"source_directory": "/Users/dannys/projects/kitura/Swift-SMTP"
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
# 5.0.0 Migration Guide
|
||||
|
||||
- The default port is now `587`.
|
||||
|
||||
- The `SMTP` struct is now initialized with a `TLSMode` enum instead of a `useTLS` Bool, allowing more configuration options:
|
||||
|
||||
```swift
|
||||
/// TLSMode enum for what form of connection security to enforce.
|
||||
public enum TLSMode {
|
||||
/// Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.
|
||||
case normal
|
||||
|
||||
/// Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.
|
||||
case ignoreTLS
|
||||
|
||||
/// Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.
|
||||
case requireTLS
|
||||
|
||||
/// Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.
|
||||
case requireSTARTTLS
|
||||
}
|
||||
```
|
||||
|
||||
# 4.0.0 Migration Guide
|
||||
|
||||
- `User` struct now nested in `Mail` struct to avoid namespace issues [(69)](https://github.com/Kitura/Swift-SMTP/pull/69). Create a user like so:
|
||||
|
||||
```swift
|
||||
let sender = Mail.User(name: "Sloth", email: "sloth@gmail.com")
|
||||
```
|
||||
|
||||
- `User` properties are now public
|
||||
|
||||
- The optional `accessToken` parameter of the `SMTP` struct has been removed. If you are using the authorization method `XOAUTH2`, pass in your access token in the `password` parameter instead. For example:
|
||||
|
||||
```swift
|
||||
let smtp = SMTP(
|
||||
hostname: "smtp.gmail.com",
|
||||
email: "example@gmail.com",
|
||||
password: "accessToken",
|
||||
authMethods: [.xoauth2]
|
||||
)
|
||||
```
|
||||
|
||||
- Fixed a bug where the wrong `Attachment` was used an an alternative to text content when a `Mail` was initialized with multiple `Attachment`s [(67)](https://github.com/Kitura/Swift-SMTP/pull/67)
|
||||
|
||||
# 3.0.0 Migration Guide
|
||||
|
||||
## Initialize `SMTP`
|
||||
|
||||
Before `3.0.0`:
|
||||
|
||||
```swift
|
||||
public init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Port = Ports.tls.rawValue,
|
||||
ssl: SSL? = nil,
|
||||
authMethods: [AuthMethod] = [],
|
||||
domainName: String = "localhost",
|
||||
accessToken: String? = nil,
|
||||
timeout: UInt = 10)
|
||||
```
|
||||
|
||||
After `3.0.0`:
|
||||
|
||||
```swift
|
||||
public init(hostname: String,
|
||||
email: String,
|
||||
password: String,
|
||||
port: Int32 = 465,
|
||||
useTLS: Bool = true,
|
||||
tlsConfiguration: TLSConfiguration? = nil,
|
||||
authMethods: [AuthMethod] = [],
|
||||
accessToken: String? = nil,
|
||||
domainName: String = "localhost",
|
||||
timeout: UInt = 10)
|
||||
```
|
||||
|
||||
## Renamed
|
||||
|
||||
- `SSL` renamed to `TLSConfiguration`
|
||||
|
||||
## Removed
|
||||
|
||||
- `Port` typealias
|
||||
|
||||
## Other Changes
|
||||
|
||||
- `Mail` properties are now public
|
||||
Reference in New Issue
Block a user