118 Commits

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

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

* Remove Swift 4.x support

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

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

* bugfix: data type for cache

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

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

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

* Update jazzy docs

* Updated package references to kitura project versions

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

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

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

* Improve comments and names

* fix tests

* fix tests, update readme/migration, regen jazzy

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

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

* loosen spm versioning

* linux swift build failure

* linux

* linux

* linux

* linux

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

* use access token as password when using xoauth2

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

* fix migration guide link

* regen jazzy

* fix linux

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

* Updated travis

* commit

* use new travis env vars for auth

* remove old credentials repo from travis

* use Swift 4.0.3

* test

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

* add swift 4 support

* change swift version
2017-10-04 17:12:55 -05:00
Quan Vo 4b07014698 Retrieve hostname for message-id as private var from 'from' address (… (#49)
* Retrieve hostname for message-id as private var from 'from' address (#45)

* Fix message id

* add unit test for message-id

* Trigger build

* Linux fixes
2017-08-31 08:51:03 -05:00
Quan Vo 205c7464ab Merge pull request #44 from IBM-Swift/issue_39
Use connect with timeout
2017-08-22 11:28:37 -05:00
Quan Vo 32deefbde2 Use connect with timeout 2017-08-22 10:08:27 -05:00
Quan Vo bac7092b49 Merge pull request #43 from IBM-Swift/issue_41
Update jazzy
2017-08-21 21:20:57 -05:00
Quan Vo fc59def561 Update jazzy 2017-08-21 15:51:01 -05:00
Quan Vo cdad458f28 Merge pull request #42 from IBM-Swift/issue_41
Fix message-id
2017-08-21 15:40:53 -05:00
Quan Vo a6cc32cdbc Fix message-id 2017-08-21 10:55:20 -05:00
Quan Vo e1bdcee0f2 Merge pull request #40 from IBM-Swift/swift_4_travis
Add Swift 4 env var to Travis
2017-08-07 11:23:23 -05:00
Quan Vo d9405067a3 Add Swift 4 env var to Travis 2017-08-07 08:51:11 -05:00
Quan Vo adf8489453 Merge pull request #38 from IBM-Swift/add_github_templates
Add GitHub templates
2017-07-17 11:00:54 -05:00
Quan Vo f7b8f2bcea Add GitHub templates 2017-07-17 10:15:47 -05:00
Quan Vo 2d1eabc6f4 Merge pull request #37 from IBM-Swift/issue_26
Ignore certain additionalHeaders
2017-07-17 09:52:42 -05:00
Quan Vo de20450050 Merge branch 'master' into issue_26 2017-07-17 08:19:11 -05:00
Quan Vo 2cafbdcfee Merge pull request #36 from IBM-Swift/issue_33
Corner cases
2017-07-17 08:18:43 -05:00
Quan Vo 189561aaf5 Rename some functions 2017-07-13 16:31:25 -05:00
Quan Vo ba023428ea Merge branch 'master' into issue_33 2017-07-13 15:04:23 -05:00
Quan Vo fa9c072c38 Ignore certain additionalHeaders 2017-07-13 14:23:51 -05:00
Quan Vo 371e86d961 Merge pull request #35 from IBM-Swift/swift4
Add Swift 4 6/29 build to Travis
2017-07-13 13:38:31 -05:00
Quan Vo faaf45bd54 Corner cases 2017-07-13 13:36:33 -05:00
Quan Vo 6b4c0ecf0b Add Swift 4 6/29 build to Travis 2017-07-13 12:31:34 -05:00
Quan Vo 348813c8f9 Merge pull request #34 from IBM-Swift/issue_32
Default to SSL config with no certs
2017-07-13 12:17:42 -05:00
Quan Vo 3234f54d99 Default to SSL config with no certs 2017-07-13 11:09:25 -05:00
Quan Vo 8bf457d080 Merge pull request #31 from IBM-Swift/issue_26
Issue 26
2017-07-10 16:26:22 -05:00
Quan Vo 4a925e7853 Linux fixes 2017-07-10 15:32:23 -05:00
Quan Vo 313a9f27f0 Linux NSCache fixes 2017-07-10 15:11:55 -05:00
Quan Vo 8653499940 Improve DataSender cache tests 2017-07-10 14:45:26 -05:00
Quan Vo 7aea5baa54 #26 - Add default headers to plain text email so that html is rendered correctly. They can be overwritten by the user. 2017-07-10 14:36:44 -05:00
Quan Vo aeb8636baa Merge pull request #30 from IBM-Swift/issue_29
Add .git to BlueCryptor dependency #29
2017-07-10 10:01:09 -05:00
Quan Vo 993afe2ae0 Add .git to BlueCryptor dependency #29 2017-07-10 09:12:43 -05:00
Quan Vo d6a0c2b7be Merge pull request #28 from IBM-Swift/issue_26
Remove header from plain text email content
2017-07-06 11:34:25 -05:00
Quan Vo d7a673880a Remove header from plain text email content 2017-07-06 11:02:59 -05:00
Quan Vo cb7b77912f Merge pull request #27 from IBM-Swift/issue_26
Let headers be overwritten. Regen Jazzy docs. #26
2017-07-05 16:21:21 -05:00
Quan Vo ba0d320750 Let headers to be overwritten. Regen Jazzy docs.#26 2017-07-05 15:50:54 -05:00
Quan Vo d9faf228d7 Merge pull request #25 from IBM-Swift/issue_23
Change log level to debug
2017-07-05 10:35:21 -05:00
Quan Vo af8c69eb78 Change log level to debug 2017-07-05 10:04:17 -05:00
Quan Vo 0d3fb77eea Merge pull request #21 from IBM-Swift/fixArrayShuffle
Fix array shuffle swift 4
2017-06-21 14:29:49 -05:00
Quan Vo 0faf214fe1 Fix array shuffle swift 4 2017-06-21 13:56:30 -05:00
Quan Vo d459dbcbaf Update README.md 2017-06-19 09:26:29 -05:00
Quan Vo 460a0844c8 Merge pull request #20 from IBM-Swift/swift4
swift 4 support and add travis builds
2017-06-15 08:05:55 -05:00
Quan Vo 9b5d218b94 swift 4 support and add travis builds 2017-06-13 13:01:56 -05:00
Quan Vo 9125e3e05c Merge pull request #19 from IBM-Swift/code_review
Code review
2017-06-07 16:19:50 -05:00
Quan Vo 70aa7a572d fix credentials 2017-06-07 15:59:30 -05:00
Quan Vo 1c75244ea4 fix credentials 2017-06-07 15:31:24 -05:00
Quan Vo 0b9870bd8d finish fixes and regen jazzy 2017-06-07 15:12:26 -05:00
Quan Vo 38fa3cbab1 Working on fixes 2017-06-06 16:48:25 -05:00
Youming Lin 830836f4f9 Fixes and suggestions 2017-06-06 14:44:41 -05:00
Quan Vo dfb1ce163e Update README 2017-06-06 13:54:18 -05:00
Quan Vo 6e6a28c6b6 Update README.md 2017-06-05 00:03:52 -05:00
Quan Vo a9932f8297 Add logo 2017-06-05 00:00:45 -05:00
Quan Vo c0e47e65fc Pull testing credentials from master branch 2017-06-04 22:42:29 -05:00
Quan Vo b715cdb36e Formatting and regen Jazzy 2017-06-01 16:38:25 -05:00
Quan Vo dd2c9788f7 Merge pull request #18 from IBM-Swift/hideCred
Remove credentials from tests. Pull from private repo in Travis.
2017-06-01 16:04:01 -05:00
Quan Vo a33a9b2c66 Clean up 2017-06-01 15:18:34 -05:00
Quan Vo de633b4568 Fix path on Linux 2017-06-01 14:50:22 -05:00
Quan Vo 3ad404a366 Redo get file paths 2017-06-01 14:45:05 -05:00
Quan Vo 28e19fa0ef Fix travis 2017-06-01 13:29:09 -05:00
Quan Vo b46d26840b Fix travis 2017-06-01 13:21:46 -05:00
Quan Vo 4d97a423dd Fix travis 2017-06-01 13:03:20 -05:00
Quan Vo 7b8e05f4b4 Fix travis 2017-06-01 12:59:00 -05:00
Quan Vo 59696164e6 Fix travis 2017-06-01 12:56:32 -05:00
Quan Vo 50e278cae8 Clone credentials repo in travis. Pull credentials out in tests. 2017-06-01 11:56:20 -05:00
Quan Vo 6efbf19fcf Clean up
Remove default auth methods static var. Simplify regex typealias. Prepare to pull credentials from separate private repo.
2017-06-01 09:19:25 -05:00
Quan Vo fac6256b06 Simply regex typealias 2017-06-01 08:57:29 -05:00
Quan Vo 4b091ff8e8 Remove default auth methods static var. Not needed. 2017-05-31 16:33:43 -05:00
91 changed files with 6768 additions and 4526 deletions
+34
View File
@@ -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.
+20
View File
@@ -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.
+2
View File
@@ -2,4 +2,6 @@
/.build
build
/Packages
Package.resolved
/*.xcodeproj
.swiftpm
+3 -3
View File
@@ -1,6 +1,6 @@
module: SwiftSMTP
author: IBM
github_url: https://github.com/IBM-Swift/Swift-SMTP/
author: IBM and Kitura project contributors
github_url: https://github.com/Kitura/Swift-SMTP/
theme: fullwidth
clean: true
@@ -11,4 +11,4 @@ readme: README.md
skip_undocumented: false
hide_documentation_coverage: false
xcodebuild_arguments: [-project, SwiftSMTP.xcodeproj, -target, SwiftSMTP, LIBRARY_SEARCH_PATHS=.build/debug]
xcodebuild_arguments: []
+1 -1
View File
@@ -1 +1 @@
3.1.1
5.1
+28 -5
View File
@@ -1,20 +1,43 @@
# Travis CI build file.
# whitelist (branches that should be built)
branches:
only:
- master
- /^issue.*$/
# the matrix of builds should cover each combination of Swift version
# and platform that is supported. The version of Swift used is specified
# by .swift-version, unless SWIFT_SNAPSHOT is specified.
matrix:
include:
- os: linux
dist: trusty
dist: bionic
sudo: required
services: docker
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu18.04:5.2.5 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
- os: linux
dist: focal
sudo: required
services: docker
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu20.04:5.4 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
- os: linux
dist: focal
sudo: required
services: docker
env: DOCKER_IMAGE=docker.kitura.net/kitura/swift-ci-ubuntu20.04:latest USE_SWIFT_DEVELOPMENT_SNAPSHOT=1 DOCKER_ENVIRONMENT="EMAIL PASSWORD"
- os: osx
osx_image: xcode8.3
osx_image: xcode12.2
sudo: required
env: JAZZY_ELIGIBLE=true
- os: osx
osx_image: xcode13.2
sudo: required
env: USE_SWIFT_DEVELOPMENT_SNAPSHOT=1
before_install:
- git clone https://github.com/IBM-Swift/Package-Builder.git
- test -n "$SWIFT_VERSION" && echo "$SWIFT_VERSION" > .swift-version || echo "SWIFT_VERSION not set, using $(cat .swift-version)"
- git clone https://github.com/Kitura/Package-Builder.git
script:
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
- ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

-5
View File
@@ -1,5 +0,0 @@
{
"autoPin": false,
"pins": [],
"version": 1
}
+20 -9
View File
@@ -1,15 +1,26 @@
// swift-tools-version:5.0
import PackageDescription
#if os(Linux) && !swift(>=3.1.1)
fatalError("Please use Swift >=3.1.1.")
#else
let package = Package(
name: "SwiftSMTP",
products: [
.library(
name: "SwiftSMTP",
targets: ["SwiftSMTP"]),
],
dependencies: [
.Package(url: "https://github.com/IBM-Swift/BlueSocket.git", majorVersion: 0, minor: 12),
.Package(url: "https://github.com/IBM-Swift/BlueSSLService.git", majorVersion: 0, minor: 12),
.Package(url: "https://github.com/IBM-Swift/BlueCryptor", 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
+118 -62
View File
@@ -1,69 +1,112 @@
# Swift-SMTP
Swift package for sending emails to an SMTP server.
![Swift-SMTP bird](https://github.com/Kitura/Swift-SMTP/blob/master/Assets/swift-smtp-bird.png?raw=true)
[![Build Status - Master](https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master)](https://travis-ci.com/IBM-Swift/Swift-SMTP.svg?token=prrUzhsjZyXD9LxyWxge&branch=master)
Swift SMTP client.
![Build Status](https://travis-ci.org/Kitura/Swift-SMTP.svg?branch=master)
![macOS](https://img.shields.io/badge/os-macOS-green.svg?style=flat)
![Linux](https://img.shields.io/badge/os-linux-green.svg?style=flat)
![Apache 2](https://img.shields.io/badge/license-Apache2-blue.svg?style=flat)
## Features
- Connect securely through SSL/TLS 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/)
- [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)
}
}
```
@@ -71,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)
@@ -123,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.
@@ -139,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
-145
View File
@@ -1,145 +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 `Mail`'s attachment.
public struct Attachment {
let type: AttachmentType
let additionalHeaders: [String: String]?
let relatedAttachments: [Attachment]?
/// Initialize a data `Attachment`.
///
/// - Parameters:
/// - data: Raw data to be sent as attachment.
/// - mime: MIME type of the data.
/// - name: File name which will be presented in the mail.
/// - 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.
/// (optional)
/// - related: Related `Attachment`s of this attachment. (optional)
public init(data: Data, mime: String, name: String, inline: Bool = false, additionalHeaders: [String: String]? = nil, relatedAttachments: [Attachment]? = nil) {
self.init(type: .data(data: data, mime: mime, name: name, inline: inline), additionalHeaders: additionalHeaders, relatedAttachments: relatedAttachments)
}
/// Initialize an `Attachment` from a local file.
///
/// - Parameters:
/// - filePath: Path to the local file.
/// - mime: MIME type of the file. Defaults to
/// `application/octet-stream`.
/// - name: Name of the file. Defaults to the name component in its
/// file path.
/// - 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.
/// (optional)
/// - related: Related `Attachment`s of this attachment. (optional)
public init(filePath: String, mime: String = "application/octet-stream", name: String? = nil, inline: Bool = false, additionalHeaders: [String: String]? = nil, relatedAttachments: [Attachment]? = nil) {
let name = name ?? NSString(string: filePath).lastPathComponent
self.init(type: .file(path: filePath, mime: mime, name: name, inline: inline), additionalHeaders: additionalHeaders, relatedAttachments: relatedAttachments)
}
/// Initialize an HTML `Attachment`.
///
/// - Parameters:
/// - htmlContent: Content string of HTML.
/// - characterSet: Character encoding of `htmlContent`. Defaults to
/// `utf-8`.
/// - alternative: Whether the HTML is an alternative for plain text or
/// not. Defaults to `true`.
/// - additionalHeaders: Additional headers for the attachment.
/// (optional)
/// - related: Related `Attachment`s of this attachment. (optional)
public init(htmlContent: String, characterSet: String = "utf-8", alternative: Bool = true, additionalHeaders: [String: String]? = nil, relatedAttachments: [Attachment]? = nil) {
self.init(type: .html(content: htmlContent, characterSet: characterSet, alternative: alternative), additionalHeaders: additionalHeaders, relatedAttachments: relatedAttachments)
}
private init(type: AttachmentType, additionalHeaders: [String: String]?, relatedAttachments: [Attachment]?) {
self.type = type
self.additionalHeaders = additionalHeaders
self.relatedAttachments = relatedAttachments
}
}
extension Attachment {
enum AttachmentType {
case data(data: Data, mime: String, name: String, inline: Bool)
case file(path: String, mime: String, name: String, inline: Bool)
case html(content: String, characterSet: String, alternative: Bool)
}
}
extension Attachment {
private var headersDictionary: [String: String] {
var result = [String: String]()
switch type {
case .data(let data):
result["CONTENT-TYPE"] = data.mime
var attachmentDisposition = data.inline ? "inline" : "attachment"
if let mime = data.name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mime)\"")
}
result["CONTENT-DISPOSITION"] = attachmentDisposition
case .file(let file):
result["CONTENT-TYPE"] = file.mime
var attachmentDisposition = file.inline ? "inline" : "attachment"
if let mime = file.name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mime)\"")
}
result["CONTENT-DISPOSITION"] = attachmentDisposition
case .html(let html):
result["CONTENT-TYPE"] = "text/html; charset=\(html.characterSet)"
result["CONTENT-DISPOSITION"] = "inline"
}
result["CONTENT-TRANSFER-ENCODING"] = "BASE64"
if let additionalHeaders = additionalHeaders {
for (key, value) in additionalHeaders {
result[key.uppercased()] = value
}
}
return result
}
var headers: String {
return headersDictionary.map { (key, value) in
return "\(key): \(value)"
}.joined(separator: CRLF)
}
}
extension Attachment {
var hasRelated: Bool {
return relatedAttachments != nil
}
var isAlternative: Bool {
if case .html(let html) = type, html.alternative {
return true
}
return false
}
}
-224
View File
@@ -1,224 +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
struct DataSender {
let socket: SMTPSocket
lazy var cache = NSCache<AnyObject, AnyObject>()
init(socket: SMTPSocket) {
self.socket = socket
}
mutating func send(_ mail: Mail) throws {
try sendHeaders(mail.headers)
if mail.hasAttachment {
try sendMixed(mail)
} else {
try sendText(mail.text)
}
}
}
extension DataSender {
func sendHeaders(_ headers: String) throws {
try send(headers)
}
func sendText(_ text: String) throws {
let embeddedText = text.embeddedText()
try send(embeddedText)
}
mutating func sendMixed(_ mail: Mail) throws {
let boundary = String.createBoundary()
let mixedHeader = String.mixedHeader(boundary: boundary)
try send(mixedHeader)
try send(boundary.startLine)
try sendAlternative(mail)
if let attachments = mail.attachments {
try sendAttachments(attachments, boundary: boundary)
}
}
mutating func sendAlternative(_ mail: Mail) throws {
if let alternative = mail.alternative {
let boundary = String.createBoundary()
let alternativeHeader = String.alternativeHeader(boundary: boundary)
try send(alternativeHeader)
try send(boundary.startLine)
try sendText(mail.text)
try send(boundary.startLine)
try sendAttachment(alternative)
try send(boundary.endLine)
return
}
try sendText(mail.text)
}
mutating func sendAttachments(_ attachments: [Attachment], boundary: String) throws {
for attachement in attachments {
try send(boundary.startLine)
try sendAttachment(attachement)
}
try send(boundary.endLine)
}
mutating func sendAttachment(_ attachment: Attachment) throws {
var relatedBoundary = ""
if attachment.hasRelated {
relatedBoundary = String.createBoundary()
let relatedHeader = String.relatedHeader(boundary: relatedBoundary)
try send(relatedHeader)
try send(relatedBoundary.startLine)
}
let attachmentHeader = attachment.headers + CRLF
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)
}
try send("")
if let relatedAttachments = attachment.relatedAttachments {
try sendAttachments(relatedAttachments, boundary: relatedBoundary)
}
}
mutating func sendData(_ data: Data) throws {
#if os(macOS)
if let encodedData = cache.object(forKey: data as AnyObject) as? Data {
return try send(encodedData)
}
#else
if let encodedData = cache.object(forKey: NSData(data: data) as AnyObject) as? Data {
return try send(encodedData)
}
#endif
let encodedData = data.base64EncodedData()
try send(encodedData)
#if os(macOS)
cache.setObject(encodedData as AnyObject, forKey: data as AnyObject)
#else
cache.setObject(NSData(data: encodedData) as AnyObject, forKey: NSData(data: data) as AnyObject)
#endif
}
mutating func sendFile(at path: String) throws {
#if os(macOS)
if let data = cache.object(forKey: path as AnyObject) as? Data {
return try send(data)
}
#else
if let data = cache.object(forKey: NSString(string: path) as AnyObject) as? Data {
return try send(data)
}
#endif
guard let file = FileHandle(forReadingAtPath: path) else {
throw SMTPError(.fileNotFound(path))
}
let data = file.readDataToEndOfFile().base64EncodedData()
try send(data)
file.closeFile()
#if os(macOS)
cache.setObject(data as AnyObject, forKey: path as AnyObject)
#else
cache.setObject(NSData(data: data) as AnyObject, forKey: NSString(string: path) as AnyObject)
#endif
}
mutating func sendHTML(_ html: String) throws {
#if os(macOS)
if let encodedHTML = cache.object(forKey: html as AnyObject) as? String {
return try send(encodedHTML)
}
#else
if let encodedHTML = cache.object(forKey: NSString(string: html) as AnyObject) as? String {
return try send(encodedHTML)
}
#endif
let encodedHTML = html.base64Encoded
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)
#endif
}
}
private extension DataSender {
func send(_ text: String) throws {
try socket.write(text)
}
func send(_ data: Data) throws {
try socket.write(data)
}
}
private extension String {
static func createBoundary() -> String {
return UUID().uuidString.replacingOccurrences(of: "-", with: "")
}
static let plainTextHeader = "CONTENT-TYPE: text/plain; charset=utf-8\(CRLF)CONTENT-TRANSFER-ENCODING: 7bit\(CRLF)CONTENT-DISPOSITION: inline\(CRLF)"
static func mixedHeader(boundary: String) -> String {
return "CONTENT-TYPE: multipart/mixed; boundary=\"\(boundary)\"\(CRLF)"
}
static func alternativeHeader(boundary: String) -> String {
return "CONTENT-TYPE: multipart/alternative; boundary=\"\(boundary)\"\(CRLF)"
}
static func relatedHeader(boundary: String) -> String {
return "CONTENT-TYPE: multipart/related; boundary=\"\(boundary)\"\(CRLF)"
}
func embeddedText() -> String {
return "\(String.plainTextHeader)\(CRLF)\(self)\(CRLF)"
}
var startLine: String {
return "--\(self)"
}
var endLine: String {
return "--\(self)--"
}
}
-191
View File
@@ -1,191 +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: 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()
// Yet another thread is created here because trying to connect on a
// "bad" port will hang that thread. Doing this on a separate one
// ensures we can call `wait` and timeout if needed.
DispatchQueue.global().async {
do {
try self.connect(self.port)
try self.loginToServer()
group.leave()
self.done(socket: self.socket, error: nil)
} catch {
group.leave()
self.done(socket: nil, error: error)
}
}
if group.wait(timeout: DispatchTime.now() + .seconds(self.timeout)) == .timedOut {
self.done(socket: nil, error: SMTPError(.couldNotConnectToServer(self.hostname, self.timeout)))
}
}
}
private func done(socket: SMTPSocket?, error: Error?) {
callback?(socket, error)
callback = nil
}
}
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))
}
}
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 {
return try socket.send(.starttls)
}
func auth(authMethod: AuthMethod, credentials: String?) throws -> Response {
return try socket.send(.auth(authMethod, credentials))
}
func authUser(_ user: String) throws {
return try socket.send(.authUser(user))
}
func authPassword(_ password: String) throws {
return try socket.send(.authPassword(password))
}
}
-137
View File
@@ -1,137 +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: [String: String]?
/// Initializes a `Mail` object.
///
/// - Parameters:
/// - from: `User` to set the `Mail`'s sender to.
/// - to: Array of `User`s to send the `Mail` to.
/// - cc: Array of `User`s to cc. (optional)
/// - bcc: Array of `User`s to bcc. (optional)
/// - subject: Subject of the `Mail`. (optional)
/// - text: Text of the `Mail`. (optional)
/// - attachments: Array of `Attachment`s for the `Mail`. (optional)
/// - additionalHeaders: Additional headers for the `Mail`. (optional)
public init(from: User, to: [User], cc: [User]? = nil, bcc: [User]? = nil, subject: String = "", text: String = "", attachments: [Attachment]? = nil, additionalHeaders: [String: String]? = nil) {
self.from = from
self.to = to
self.cc = cc
self.bcc = bcc
self.subject = subject
self.text = text
if let attachments = attachments {
let result = attachments.takeLast { $0.isAlternative }
self.alternative = result.0
self.attachments = result.1
} else {
self.alternative = nil
self.attachments = nil
}
self.additionalHeaders = additionalHeaders
}
}
extension Mail {
private var headersDictionary: [String: String] {
var fields = [String: String]()
fields["MESSAGE-ID"] = id
fields["DATE"] = Date().smtpFormatted
fields["FROM"] = from.mime
fields["TO"] = to.map { $0.mime }.joined(separator: ", ")
if let cc = cc {
fields["CC"] = cc.map { $0.mime }.joined(separator: ", ")
}
fields["SUBJECT"] = subject.mimeEncoded ?? ""
fields["MIME-VERSION"] = "1.0 (Swift-SMTP)"
if let additionalHeaders = additionalHeaders {
for (key, value) in additionalHeaders {
fields[key.uppercased()] = value
}
}
return fields
}
var headers: String {
return headersDictionary.map { (key, value) in
return "\(key): \(value)"
}.joined(separator: CRLF)
}
}
extension Mail {
var hasAttachment: Bool {
return attachments != nil
}
}
extension DateFormatter {
static let smtpDateFormatter: DateFormatter = {
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "en-US")
formatter.dateFormat = "EEE, d MMM yyyy HH:mm:ss ZZZ"
return formatter
}()
}
extension Date {
var smtpFormatted: String {
return DateFormatter.smtpDateFormatter.string(from: self)
}
}
extension Array {
func takeLast(where condition: (Element) -> Bool) -> (Element?, Array) {
var index: Int?
for i in (0 ..< count).reversed() {
if condition(self[i]) {
index = i
break
}
}
if let index = index {
var array = self
let ele = array.remove(at: index)
return (ele, array)
} else {
return (nil, self)
}
}
}
-165
View File
@@ -1,165 +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"
static fileprivate let defaultAuthMethods: [AuthMethod] = [.cramMD5, .login, .plain, .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 all supported ones--currently
/// `CRAM-MD5`, `LOGIN`, `PLAIN`, `XOAUTH2`.
/// - domainName: Client domain name used when communicating with the
/// server. Defaults to `localhost`.
/// - accessToken: Access token used if logging in through `XOAUTH2`.
/// - 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.
public init(hostname: String, email: String, password: String, port: Port = Ports.tls.rawValue, ssl: SSL? = nil, authMethods: [AuthMethod] = AuthMethod.defaultAuthMethods,
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.defaultAuthMethods
}
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.
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) })
}
}
}
-107
View File
@@ -1,107 +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
struct SMTPSocket {
let socket: Socket
init() throws {
socket = try Socket.create()
}
func connect(to: String, port: Port) throws {
try socket.connect(to: to, port: port)
}
func setDelegate(_ delegate: SSLServiceDelegate?) {
socket.delegate = delegate
}
func close() {
socket.close()
}
}
extension SMTPSocket {
func send(_ command: Command) throws {
try write(command.text)
_ = try SMTPSocket.parseResponses(try readFromSocket(), command: command)
}
func send(_ command: Command) throws -> Response {
try write(command.text)
return try SMTPSocket.parseResponses(try readFromSocket(), command: command)[0]
}
func send(_ command: Command) throws -> [Response] {
try write(command.text)
return try SMTPSocket.parseResponses(try readFromSocket(), command: command)
}
}
extension SMTPSocket {
func write(_ commandText: String) throws {
_ = try socket.write(from: commandText + CRLF)
Log.verbose(commandText)
}
func write(_ data: Data) throws {
_ = try socket.write(from: data)
Log.verbose("(sending data)")
}
}
extension SMTPSocket {
func readFromSocket() throws -> String {
var buf = Data()
_ = try socket.read(into: &buf)
guard let res = String(data: buf, encoding: .utf8) else {
throw SMTPError(.convertDataUTF8Fail(buf))
}
Log.verbose(res)
return res
}
static func parseResponses(_ responses: String, command: Command) throws -> [Response] {
var validResponses = [Response]()
let resArr = responses.components(separatedBy: CRLF)
for res in resArr {
if res == "" { break }
validResponses.append(Response(code: try getResponseCode(res, command: command), message: getResponseMessage(res), response: res))
}
return validResponses
}
static func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
guard response.characters.count >= 3 else {
throw SMTPError(.badResponse(command.text, response))
}
let range = response.startIndex..<response.index(response.startIndex, offsetBy: 3)
guard let responseCode = Int(response[range]), command.expectedResponseCodes.contains(ResponseCode(responseCode)) else {
throw SMTPError(.badResponse(command.text, response))
}
return ResponseCode(responseCode)
}
static func getResponseMessage(_ response: String) -> String {
if response.characters.count < 4 { return "" }
let range = response.index(response.startIndex, offsetBy: 4)..<response.endIndex
return response[range]
}
}
-89
View File
@@ -1,89 +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)
}
}
+223
View File
@@ -0,0 +1,223 @@
/**
* 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 `Mail`'s attachment.
/// Different SMTP servers have different attachment size limits.
public struct Attachment {
let type: AttachmentType
let additionalHeaders: [String: String]
let relatedAttachments: [Attachment]
/// Initialize a data `Attachment`.
///
/// - Parameters:
/// - data: Raw data to be sent as attachment.
/// - mime: MIME type of the data.
/// - name: File name which will be presented in the mail.
/// - 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 `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: [String: String] = [:],
relatedAttachments: [Attachment] = []) {
self.init(type: .data(data: data,
mime: mime,
name: name,
inline: inline),
additionalHeaders: additionalHeaders,
relatedAttachments: relatedAttachments)
}
/// Initialize an `Attachment` from a local file.
///
/// - Parameters:
/// - filePath: Path to the local file.
/// - mime: MIME type of the file. Defaults to
/// `application/octet-stream`.
/// - name: Name of the file. Defaults to the name component in its
/// file path.
/// - 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. 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: [String: String] = [:],
relatedAttachments: [Attachment] = []) {
let name = name ?? NSString(string: filePath).lastPathComponent
self.init(type: .file(path: filePath,
mime: mime,
name: name,
inline: inline),
additionalHeaders: additionalHeaders,
relatedAttachments: relatedAttachments)
}
/// Initialize an HTML `Attachment`.
///
/// - Parameters:
/// - htmlContent: Content string of HTML.
/// - characterSet: Character encoding of `htmlContent`. Defaults to
/// `utf-8`.
/// - alternative: Whether the HTML is an alternative for plain text or
/// not. Defaults to `true`.
/// - 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: [String: String] = [:],
relatedAttachments: [Attachment] = []) {
self.init(type: .html(content: htmlContent,
characterSet: characterSet,
alternative: alternative),
additionalHeaders: additionalHeaders,
relatedAttachments: relatedAttachments)
}
private init(type: AttachmentType,
additionalHeaders: [String: String],
relatedAttachments: [Attachment]) {
self.type = type
self.additionalHeaders = additionalHeaders
self.relatedAttachments = relatedAttachments
}
}
extension Attachment {
enum AttachmentType {
case data(data: Data, mime: String, name: String, inline: Bool)
case file(path: String, mime: String, name: String, inline: Bool)
case html(content: String, characterSet: String, alternative: Bool)
}
}
extension Attachment {
private var headersDictionary: [String: String] {
var dictionary = [String: String]()
switch type {
case .data(_, let mime, let name, let inline):
dictionary["CONTENT-TYPE"] = mime
var attachmentDisposition = inline ? "inline" : "attachment"
if let mimeName = name.mimeEncoded {
attachmentDisposition.append("; filename=\"\(mimeName)\"")
}
dictionary["CONTENT-DISPOSITION"] = attachmentDisposition
case .file(_, let 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"
}
dictionary["CONTENT-TRANSFER-ENCODING"] = "BASE64"
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)
}
}
extension Attachment {
var hasRelated: Bool {
return !relatedAttachments.isEmpty
}
var isAlternative: Bool {
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,8 +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
@@ -43,8 +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(self))
guard let data = Data(base64Encoded: self, options: .ignoreUnknownCharacters),
let base64Decoded = String(data: data, encoding: .utf8) else {
throw SMTPError.base64DecodeFail(string: self)
}
return base64Decoded
}
+29
View File
@@ -0,0 +1,29 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Supported authentication methods for logging into the SMTP server.
public enum AuthMethod: String {
/// CRAM-MD5 authentication.
case cramMD5 = "CRAM-MD5"
/// LOGIN authentication.
case login = "LOGIN"
/// PLAIN authentication.
case plain = "PLAIN"
/// XOAUTH2 authentication. Requires a valid access token.
case xoauth2 = "XOAUTH2"
}
@@ -36,18 +36,16 @@ enum Command {
case .ehlo(let domain): return "EHLO \(domain)"
case .helo(let domain): return "HELO \(domain)"
case .starttls: return "STARTTLS"
case .auth(let method, let credentials):
if let credentials = credentials {
return "AUTH \(method.rawValue) \(credentials)"
} else {
return "AUTH \(method.rawValue)"
}
case .authUser(let user): return user
case .authPassword(let password): return password
case .mail(let from): return "MAIL FROM: <\(from)>"
case .rcpt(let to): return "RCPT TO: <\(to)>"
case .mail(let from): return "MAIL FROM:<\(from)>"
case .rcpt(let to): return "RCPT TO:<\(to)>"
case .data: return "DATA"
case .dataEnd: return "\(CRLF)."
case .quit: return "QUIT"
@@ -65,9 +63,9 @@ enum Command {
case .plain: return [.authSucceeded]
case .xoauth2: return [.authSucceeded]
}
case .authUser(_): return [.containingChallenge]
case .authUser: return [.containingChallenge]
case .authPassword: return [.authSucceeded]
case .rcpt(_): return [.commandOK, .willForward]
case .rcpt: return [.commandOK, .willForward]
case .data: return [.startMailInput]
case .quit: return [.connectionClosing, .commandOK]
default: return [.commandOK]
@@ -16,15 +16,26 @@
import Foundation
enum Result<T, Error> {
case success(T)
case failure(Error)
}
let cache = NSCache<AnyObject, AnyObject>()
let CRLF = "\r\n"
extension String {
var base64Encoded: String {
return Data(utf8).base64EncodedString()
}
var base64EncodedWithLineLimit: String {
return Data(utf8).base64EncodedString(options: .lineLength76Characters)
}
var mimeEncoded: String? {
guard let encoded = addingPercentEncoding(
withAllowedCharacters: .urlQueryAllowed) else {
return nil
guard let encoded = addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
return nil
}
let quoted = encoded
.replacingOccurrences(of: "%20", with: "_")
.replacingOccurrences(of: ",", with: "%2C")
@@ -32,9 +43,3 @@ extension String {
return "=?UTF-8?Q?\(quoted)?="
}
}
extension String {
var base64Encoded: String {
return Data(utf8).base64EncodedString()
}
}
+256
View File
@@ -0,0 +1,256 @@
/**
* 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 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`.
// This is handled by `Sender`.
struct DataSender {
// Socket we use to read and write data to
private let socket: SMTPSocket
// Init a new instance of `DataSender`
init(socket: SMTPSocket) {
self.socket = socket
}
// Send the text and attachments of the `mail`
func send(_ mail: Mail) throws {
try sendHeaders(mail.headersString)
if mail.hasAttachment {
try sendMixed(mail)
} else {
try sendText(mail.text)
}
}
}
extension DataSender {
// Send the headers of a `Mail`
func sendHeaders(_ headers: String) throws {
try send(headers)
}
// Add custom/default headers to a `Mail`'s text and write it to the socket.
func sendText(_ text: String) throws {
try send(text.embedded)
}
// Send `mail`'s content that is more than just plain text
func sendMixed(_ mail: Mail) throws {
let boundary = String.makeBoundary()
let mixedHeader = String.makeMixedHeader(boundary: boundary)
try send(mixedHeader)
try send(boundary.startLine)
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.
// Else just sends the plain text.
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(mail.text)
try send(boundary.startLine)
try sendAttachment(alternative)
try send(boundary.endLine)
return
}
try sendText(mail.text)
}
// Sends the attachments of a `Mail`.
func sendAttachments(_ attachments: [Attachment], boundary: String) throws {
for attachment in attachments {
try send(boundary.startLine)
try sendAttachment(attachment)
}
try send(boundary.endLine)
}
// Send the `attachment`.
func sendAttachment(_ attachment: Attachment) throws {
var relatedBoundary = ""
if attachment.hasRelated {
relatedBoundary = String.makeBoundary()
let relatedHeader = String.makeRelatedHeader(boundary: relatedBoundary)
try send(relatedHeader)
try send(relatedBoundary.startLine)
}
let attachmentHeader = attachment.headersString + CRLF
try send(attachmentHeader)
switch attachment.type {
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)
}
}
// Send a data attachment. Data must be base 64 encoded before sending.
// Checks if the base 64 encoded version has been cached first.
func sendData(_ data: Data) throws {
#if os(macOS)
if let encodedData = cache.object(forKey: data as AnyObject) as? Data {
return try send(encodedData)
}
#else
if let encodedData = cache.object(forKey: NSData(data: data) as AnyObject) as? Data {
return try send(encodedData)
}
#endif
let encodedData = data.base64EncodedData(options: .lineLength76Characters)
try send(encodedData)
#if os(macOS)
cache.setObject(encodedData as AnyObject, forKey: data as AnyObject)
#else
cache.setObject(NSData(data: encodedData) as AnyObject, forKey: NSData(data: data) as AnyObject)
#endif
}
// 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.
func sendFile(at path: String) throws {
#if os(macOS)
if let data = cache.object(forKey: path as AnyObject) as? Data {
return try send(data)
}
#else
if let data = cache.object(forKey: NSString(string: path) as AnyObject) as? Data {
return try send(data)
}
#endif
guard let file = FileHandle(forReadingAtPath: path) else {
throw SMTPError.fileNotFound(path: path)
}
let data = file.readDataToEndOfFile().base64EncodedData(options: .lineLength76Characters)
try send(data)
file.closeFile()
#if os(macOS)
cache.setObject(data as AnyObject, forKey: path as AnyObject)
#else
cache.setObject(NSData(data: data) as AnyObject, forKey: NSString(string: path) as AnyObject)
#endif
}
// Send an HTML attachment. HTML must be base 64 encoded before sending.
// Checks if the base 64 encoded version is in cache first.
func sendHTML(_ html: String) throws {
#if os(macOS)
if let encodedHTML = cache.object(forKey: html as AnyObject) as? String {
return try send(encodedHTML)
}
#else
if let encodedHTML = cache.object(forKey: NSString(string: html) as AnyObject) as? String {
return try send(encodedHTML)
}
#endif
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(NSData(data: encodedHTML) as AnyObject, forKey: NSString(string: html) as AnyObject)
#endif
}
}
private extension DataSender {
// Write `text` to the socket.
func send(_ text: String) throws {
Log.debug("SEND: \(text)")
try socket.write(text)
}
// Write `data` to the socket.
func send(_ data: Data) throws {
Log.debug("SEND: data \(data.count) bytes")
try socket.write(data)
}
}
private extension String {
// Embed plain text content of emails with the proper headers so that it is 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 mixed type email.
static func makeMixedHeader(boundary: String) -> String {
return "CONTENT-TYPE: multipart/mixed; boundary=\"\(boundary)\"\(CRLF)"
}
// Header for an alternative email.
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 makeRelatedHeader(boundary: String) -> String {
return "CONTENT-TYPE: multipart/related; boundary=\"\(boundary)\"\(CRLF)"
}
// Added to a boundary to indicate the beginning of the corresponding section.
var startLine: String {
return "--\(self)"
}
// Added to a boundary to indicate the end of the corresponding section.
var endLine: String {
return "--\(self)--"
}
}
+198
View File
@@ -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,21 +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], progress: Progress, completion: Completion) {
init(socket: SMTPSocket,
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)
@@ -47,46 +54,40 @@ 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()
}
}
func quit() throws {
let _: Void = try socket.send(.quit)
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)
@@ -95,58 +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 }
if let cc = mail.cc {
recipientEmails += cc.map { $0.email }
}
if let bcc = mail.bcc {
recipientEmails += bcc.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))
throw SMTPError.invalidEmail(email: email)
}
}
private func sendMail(_ from: String) throws {
return try socket.send(.mail(from))
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 {
let _: Void = try socket.send(.rcpt(email))
try socket.send(.rcpt(email))
}
}
private func data() throws {
return try socket.send(.data)
func data() throws {
try socket.send(.data)
}
private func dataEnd() throws {
return try socket.send(.dataEnd)
func dataEnd() throws {
try socket.send(.dataEnd)
}
}
#if os(Linux) && !swift(>=3.1)
private typealias Regex = RegularExpression
#else
private typealias Regex = NSRegularExpression
#endif
private extension Regex {
static let emailRegex = try? Regex(pattern: "^[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}", options: [])
private extension NSRegularExpression {
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 = Regex.emailRegex else {
throw SMTPError(.createEmailRegexFailed)
guard let emailRegex = NSRegularExpression.emailRegex else {
throw SMTPError.createEmailRegexFailed
}
let range = NSRange(location: 0, length: utf16.count)
let range = NSRange(location: 0, length: count)
return !emailRegex.matches(in: self, options: [], range: range).isEmpty
}
}
+158
View File
@@ -0,0 +1,158 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Used to connect to an SMTP server and send emails.
public struct SMTP {
private let hostname: String
private let email: String
private let password: String
private let port: Int32
private let tlsMode: TLSMode
private let tlsConfiguration: TLSConfiguration?
private let authMethods: [String: AuthMethod]
private let domainName: String
private let timeout: UInt
/// TLSMode enum for what form of connection security to enforce.
public enum TLSMode {
/// Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.
case normal
/// Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.
case ignoreTLS
/// Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.
case requireTLS
/// Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.
case requireSTARTTLS
}
/// Initializes an `SMTP` instance.
///
/// - Parameters:
/// - hostname: Hostname of the SMTP server to connect to, i.e. `smtp.example.com`.
/// - email: Username to log in to server.
/// - password: Password to log in to server, or access token if using XOAUTH2 authorization method.
/// - port: Port to connect to the server on. Defaults to `465`.
/// - tlsMode: TLSMode `enum` indicating what form of connection security to use.
/// - tlsConfiguration: `TLSConfiguration` used to connect with TLS. If nil, a configuration with no backing
/// certificates is used. See `TLSConfiguration` for other configuration options.
/// - authMethods: `AuthMethod`s to use to log in to the server. If blank, tries all supported methods.
/// - domainName: Client domain name used when communicating with the server. Defaults to `localhost`.
/// - timeout: How long to try connecting to the server to before returning an error. Defaults to `10` seconds.
///
/// - Note:
/// - You may need to enable access for less secure apps for your account on the SMTP server.
/// - Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
/// IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.
public init(hostname: String,
email: String,
password: String,
port: Int32 = 587,
tlsMode: TLSMode = .requireSTARTTLS,
tlsConfiguration: TLSConfiguration? = nil,
authMethods: [AuthMethod] = [],
domainName: String = "localhost",
timeout: UInt = 10) {
self.hostname = hostname
self.email = email
self.password = password
self.port = port
self.tlsMode = tlsMode
self.tlsConfiguration = tlsConfiguration
let _authMethods = !authMethods.isEmpty ? authMethods : [
AuthMethod.cramMD5,
AuthMethod.login,
AuthMethod.plain,
AuthMethod.xoauth2
]
var authMethodsDictionary = [String: AuthMethod]()
_authMethods.forEach { authMethod in
authMethodsDictionary[authMethod.rawValue] = authMethod
}
self.authMethods = authMethodsDictionary
self.domainName = domainName
self.timeout = timeout
}
/// Send an email.
///
/// - Parameters:
/// - mail: `Mail` object to send.
/// - completion: Callback when sending finishes. `Error` is nil on success. (optional)
public func send(_ mail: Mail, completion: ((Error?) -> Void)? = nil) {
send([mail], completion: { (_, failed) in
if let error = failed.first?.1 {
completion?(error)
} else {
completion?(nil)
}
})
}
/// Send multiple emails.
///
/// - Parameters:
/// - mails: Array of `Mail`s to send.
/// - progress: (`Mail`, `Error`) callback after each `Mail` is sent. `Mail` is the mail sent and `Error` is
/// the error if it failed. (optional)
/// - completion: ([`Mail`], [(`Mail`, `Error`)]) callback after all `Mail`s have been attempted. [`Mail`] is an
/// array of successfully sent `Mail`s. [(`Mail`, `Error`)] is an array of failed `Mail`s and their
/// corresponding `Error`s. (optional)
///
/// - Note:
/// - Each call to `send` will first log in to your server, attempt to send the mails, then closes the
/// connection. Pass in an array of `Mail`s to send them all in one session.
/// - If any of the email addresses in a `Mail`'s `to`, `cc`, or `bcc` are invalid, the entire mail will not
/// send and return an `SMTPError`.
/// - If an individual `Mail` fails while sending an array of `Mail`s, the whole sending process will continue
/// until all pending `Mail`s are attempted.
/// - Each call to `send` queues it's `Mail`s and sends them one by one. To send `Mail`s concurrently, send them
/// in separate calls to `send`.
public func send(_ mails: [Mail],
progress: Progress = nil,
completion: Completion = nil) {
if mails.isEmpty {
completion?([], [])
return
}
do {
let socket = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: port,
tlsMode: tlsMode,
tlsConfiguration: tlsConfiguration,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
MailSender(
socket: socket,
mailsToSend: mails,
progress: progress,
completion: completion).send()
} catch {
completion?([], mails.map { ($0, error) })
}
}
}
@@ -21,43 +21,38 @@ import LoggerAPI
public enum SMTPError: Error, CustomStringConvertible {
// AuthCredentials
/// Error decoding string.
case base64DecodeFail(String)
case base64DecodeFail(string: String)
/// Hashing server challenge with MD5 algorithm failed.
case md5HashChallengeFail
// DataSender
/// File not found at path while trying to send file `Attachment`.
case fileNotFound(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(String, Int)
/// The preferred `AuthMethod`s could not be found. Connecting with `SSL`
/// may be required.
case noSupportedAuthMethods(String)
/// Attempted to login using `XOAUTH2` but `SMTP` instance was initialized
/// without an access token.
case noAccessToken
case fileNotFound(path: String)
/// 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
// SMTPSocket
/// Bad response received for command.
case badResponse(String, String)
case badResponse(command: String, response: String)
/// Error converting Data read from socket to a String.
case convertDataUTF8Fail(Data)
case convertDataUTF8Fail(data: Data)
// User
/// Invalid email provided for `User`.
case invalidEmail(String)
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)
}
}
+239
View File
@@ -0,0 +1,239 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
import Socket
import LoggerAPI
struct SMTPSocket {
private let socket: Socket
init(hostname: String,
email: String,
password: String,
port: Int32,
tlsMode: SMTP.TLSMode,
tlsConfiguration: TLSConfiguration?,
authMethods: [String: AuthMethod],
domainName: String,
timeout: UInt) throws {
socket = try Socket.create()
if tlsMode == .requireTLS {
if let tlsConfiguration = tlsConfiguration {
socket.delegate = try tlsConfiguration.makeSSLService()
} else {
socket.delegate = try TLSConfiguration().makeSSLService()
}
}
try socket.connect(to: hostname, port: port, timeout: timeout * 1000)
try parseResponses(readFromSocket(), command: .connect)
var serverOptions = try getServerOptions(domainName: domainName)
if tlsMode == .requireSTARTTLS || tlsMode == .normal {
if try doStarttls(serverOptions: serverOptions, tlsConfiguration: tlsConfiguration) {
serverOptions = try getServerOptions(domainName: domainName)
} else if tlsMode == .requireSTARTTLS {
throw SMTPError.requiredSTARTTLS
}
}
let authMethod = try getAuthMethod(authMethods: authMethods, serverOptions: serverOptions, hostname: hostname)
try login(authMethod: authMethod, email: email, password: password)
}
func write(_ text: String) throws {
_ = try socket.write(from: text + CRLF)
Log.debug(text)
}
func write(_ data: Data) throws {
_ = try socket.write(from: data)
Log.debug("(sending data)")
}
@discardableResult
func send(_ command: Command) throws -> [Response] {
try write(command.text)
return try parseResponses(readFromSocket(), command: command)
}
func close() {
socket.close()
}
}
private extension SMTPSocket {
func readFromSocket() throws -> String {
var buf = Data()
_ = try socket.read(into: &buf)
guard let responses = String(data: buf, encoding: .utf8) else {
throw SMTPError.convertDataUTF8Fail(data: buf)
}
Log.debug(responses)
return responses
}
@discardableResult
func parseResponses(_ responses: String, command: Command) throws -> [Response] {
let responsesArray = responses.components(separatedBy: CRLF)
guard !responsesArray.isEmpty else {
throw SMTPError.badResponse(command: command.text, response: responses)
}
#if swift(>=4.1)
return try responsesArray.compactMap { response in
guard response != "" else {
return nil
}
return Response(
code: try getResponseCode(response, command: command),
message: getResponseMessage(response),
response: response
)
}
#else
return try responsesArray.flatMap { response in
guard response != "" else {
return nil
}
return Response(
code: try getResponseCode(response, command: command),
message: getResponseMessage(response),
response: response
)
}
#endif
}
func getResponseCode(_ response: String, command: Command) throws -> ResponseCode {
guard response.count > 3 else {
throw SMTPError.badResponse(command: command.text, response: response)
}
guard let code = Int(response[..<response.index(response.startIndex, offsetBy: 3)]) else {
throw SMTPError.badResponse(command: command.text, response: response)
}
guard
response.count > 2,
command.expectedResponseCodes.map({ $0.rawValue }).contains(code) else {
throw SMTPError.badResponse(command: command.text, response: response)
}
return ResponseCode(code)
}
func getResponseMessage(_ response: String) -> String {
guard response.count > 3 else {
return ""
}
return String(response[response.index(response.startIndex, offsetBy: 4)...])
}
}
private extension SMTPSocket {
func getServerOptions(domainName: String) throws -> [Response] {
do {
return try send(.ehlo(domainName))
} catch {
return try send(.helo(domainName))
}
}
func getAuthMethod(authMethods: [String: AuthMethod], serverOptions: [Response], hostname: String) throws -> AuthMethod {
for option in serverOptions {
let components = option.message.components(separatedBy: " ")
if components.first == "AUTH" {
let _authMethods = components.dropFirst()
for authMethod in _authMethods {
if let matchingAuthMethod = authMethods[authMethod] {
return matchingAuthMethod
}
}
}
}
throw SMTPError.noAuthMethodsOrRequiresTLS(hostname: hostname)
}
func doStarttls(serverOptions: [Response], tlsConfiguration: TLSConfiguration?) throws -> Bool {
for option in serverOptions {
if option.message == "STARTTLS" {
try starttls(tlsConfiguration: tlsConfiguration)
return true
}
}
return false
}
func starttls(tlsConfiguration: TLSConfiguration?) throws {
try send(.starttls)
// Upgrade the socket to SSL/TLS
if let tlsConfiguration = tlsConfiguration {
socket.delegate = try tlsConfiguration.makeSSLService()
} else {
socket.delegate = try TLSConfiguration().makeSSLService()
}
try socket.delegate?.initialize(asServer: false)
try socket.delegate?.onConnect(socket: socket)
}
func login(authMethod: AuthMethod, email: String, password: String) throws {
switch authMethod {
case .cramMD5:
try loginCramMD5(email: email, password: password)
case .login:
try loginLogin(email: email, password: password)
case .plain:
try loginPlain(email: email, password: password)
case .xoauth2:
try loginXOAuth2(email: email, accessToken: password)
}
}
func loginCramMD5(email: String, password: String) throws {
let challenge = try auth(authMethod: .cramMD5, credentials: nil).message
try authPassword(try AuthEncoder.cramMD5(challenge: challenge, user: email, password: password))
}
func loginLogin(email: String, password: String) throws {
try auth(authMethod: .login, credentials: nil)
let credentials = AuthEncoder.login(user: email, password: password)
try authUser(credentials.encodedUser)
try authPassword(credentials.encodedPassword)
}
func loginPlain(email: String, password: String) throws {
try auth(
authMethod: .plain,
credentials: AuthEncoder.plain(user: email, password: password)
)
}
func loginXOAuth2(email: String, accessToken: String) throws {
try auth(authMethod: .xoauth2, credentials: AuthEncoder.xoauth2(user: email, accessToken: accessToken))
}
@discardableResult
func auth(authMethod: AuthMethod, credentials: String?) throws -> Response {
let responses = try send(.auth(authMethod, credentials))
guard let response = responses.first else {
throw SMTPError.badResponse(command: "AUTH", response: responses.description)
}
return response
}
func authUser(_ user: String) throws {
try send(.authUser(user))
}
func authPassword(_ password: String) throws {
try send(.authPassword(password))
}
}
+135
View File
@@ -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)
}
}
-43
View File
@@ -1,43 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import Foundation
/// Represents a sender or receiver of an email.
public struct User {
fileprivate let name: String?
let email: String
/// Initializes a `User`.
///
/// - Parameters:
/// - name: Display name for the user. Defaults to nil.
/// - 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
}
}
}
+7 -7
View File
@@ -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())
+109 -46
View File
@@ -15,68 +15,131 @@
**/
import SwiftSMTP
import Foundation
#if os(Linux)
import Glibc
#else
import Foundation
#endif
let testDuration: Double = 20
let testDuration: Double = 15
let hostname = "smtp.gmail.com"
let email = "kiturasmtp" + Int.randomEmailNum(4) + "@gmail.com"
let email2 = "kiturasmtp@gmail.com"
let password = "ibm12345"
let port = Ports.tls.rawValue
let secure = true
let authMethods: [AuthMethod] = [.cramMD5, .login, .plain, .xoauth2]
// 📧📧📧 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 = 10
let timeout: UInt = 10
let root = #file
.characters
.split(separator: "/", omittingEmptySubsequences: false)
.dropLast(1)
.map { String($0) }
.joined(separator: "/")
let email: String = {
if let email = myEmail {
return email
}
guard let email = ProcessInfo.processInfo.environment["EMAIL"] else {
fatalError("Please provide email credentials for local testing.")
}
return email
}()
let password: String = {
if let password = myPassword {
return password
}
guard let password = ProcessInfo.processInfo.environment["PASSWORD"] else {
fatalError("Please provide email credentials for local testing.")
}
return password
}()
let senderEmailDomain: String = {
#if swift(>=5)
if let atIndex = email.firstIndex(of: "@") {
let domainStart = email.index(after: atIndex)
return String(email[domainStart...])
} else {
return "gmail.com"
}
#else
if let atIndex = email.index(of: "@") {
let domainStart = email.index(after: atIndex)
return String(email[domainStart...])
} else {
return "gmail.com"
}
#endif
}()
let testsDir: String = {
return URL(fileURLWithPath: #file).appendingPathComponent("..").standardized.path
}()
#if os(Linux)
let cert = root + "/cert.pem"
let key = root + "/key.pem"
let ssl = SSL(withCACertificateDirectory: nil, usingCertificateFile: cert, withKeyFile: key)
let cert = testsDir + "/cert.pem"
let key = testsDir + "/key.pem"
let tlsConfiguration = TLSConfiguration(withCACertificateDirectory: nil, usingCertificateFile: cert, withKeyFile: key)
#else
let cert = root + "/cert.pfx"
let certPassword = "kitura"
let ssl = SSL(withChainFilePath: cert, withPassword: certPassword)
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, ssl: ssl)
let from = User(name: "Dr. Light", email: email)
let to = User(name: "Megaman", email: email2)
let to2 = User(name: "Roll", email: "kiturasmtp2@gmail.com")
let text = "Humans and robots living together in harmony and equality. That was my ultimate wish."
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 = root + "/x.png"
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 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 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="
private extension Int {
static func randomEmailNum(_ max: Int) -> String {
#if os(Linux)
srand(UInt32(time(nil)))
let r = Int(random() % max)
#else
let r = Int(arc4random_uniform(UInt32(max)))
#endif
if r == 0 { return "" }
return String(r)
}
}
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")
+20 -4
View File
@@ -22,20 +22,21 @@ class TestAttachment: XCTestCase {
return [
("testDataAttachmentHeaders", testDataAttachmentHeaders),
("testFileAttachmentHeaders", testFileAttachmentHeaders),
("testHTMLAttachmentHeaders", testHTMLAttachmentHeaders)
("testHTMLAttachmentHeaders", testHTMLAttachmentHeaders),
("testGetAlternativeAttachment", testGetAlternativeAttachment)
]
}
func testDataAttachmentHeaders() {
let data = "{\"key\": \"hello world\"}".data(using: .utf8)!
let headers = Attachment(data: data, mime: "application/json", name: "file.json").headers
let headers = Attachment(data: data, mime: "application/json", name: "file.json").headersString
XCTAssert(headers.contains("CONTENT-TYPE: application/json"))
XCTAssert(headers.contains("CONTENT-DISPOSITION: attachment; filename=\"=?UTF-8?Q?file.json?=\""))
XCTAssert(headers.contains("CONTENT-TRANSFER-ENCODING: BASE64"))
}
func testFileAttachmentHeaders() {
let headers = Attachment(filePath: imgFilePath, additionalHeaders: ["CONTENT-ID": "megaman-pic"]).headers
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"))
@@ -43,10 +44,25 @@ class TestAttachment: XCTestCase {
}
func testHTMLAttachmentHeaders() {
let headers = Attachment(htmlContent: html).headers
let headers = Attachment(htmlContent: html).headersString
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)
}
}
+4 -166
View File
@@ -23,9 +23,6 @@ import XCTest
class TestDataSender: XCTestCase {
static var allTests = [
("testDataCache", testDataCache),
("testFileCache", testFileCache),
("testHTMLCache", testHTMLCache),
("testSendData", testSendData),
("testSendFile", testSendFile),
("testSendHTML", testSendHTML),
@@ -35,169 +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, mail], progress: nil) { (sent, failed) in
XCTAssertEqual(sent.count, 2)
XCTAssertEqual(failed.count, 0)
group.leave()
}
sender?.send()
}
}.login()
group.wait()
#if os(macOS)
let cachedFile = sender?.dataSender.cache.object(forKey: data as AnyObject)
#else
let cachedFile = sender?.dataSender.cache.object(forKey: NSData(data: data) as AnyObject)
#endif
XCTAssertNotNil(cachedFile)
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, mail], progress: nil) { (sent, failed) in
XCTAssertEqual(sent.count, 2)
XCTAssertEqual(failed.count, 0)
group.leave()
}
sender?.send()
}
}.login()
group.wait()
#if os(macOS)
let cachedFile = sender?.dataSender.cache.object(forKey: imgFilePath as AnyObject)
#else
let cachedFile = sender?.dataSender.cache.object(forKey: NSString(string: imgFilePath) as AnyObject)
#endif
XCTAssertNotNil(cachedFile)
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, mail], progress: nil) { (sent, failed) in
XCTAssertEqual(sent.count, 2)
XCTAssertEqual(failed.count, 0)
group.leave()
}
sender?.send()
}
}.login()
group.wait()
#if os(macOS)
let cachedFile = sender?.dataSender.cache.object(forKey: html as AnyObject)
#else
let cachedFile = sender?.dataSender.cache.object(forKey: NSString(string: html) as AnyObject)
#endif
XCTAssertNotNil(cachedFile)
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()
@@ -208,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()
@@ -263,8 +101,8 @@ 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 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()
-79
View File
@@ -1,79 +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)
})
}
}
+67 -50
View File
@@ -23,19 +23,45 @@ import XCTest
class TestMiscellaneous: XCTestCase {
static var allTests = [
("testBase64Encoded", testBase64Encoded),
("testMimeEncoded", testMimeEncoded),
("testDateFormatter", testDateFormatter),
("testMailHeaders", testMailHeaders),
("testTakeLast1", testTakeLast1),
("testTakeLast1", testTakeLast1),
("testMimeNoName", testMimeNoName),
("testMimeWithName", testMimeWithName),
("testBase64Encoded", testBase64Encoded),
("testMimeEncoded", testMimeEncoded)
("testMimeWithName", testMimeWithName)
]
}
let a = ["a"]
let b = ["b"]
let ab = ["a", "c"]
// Common
extension TestMiscellaneous {
func testBase64Encoded() {
let result1 = randomText1.base64Encoded
XCTAssertEqual(result1, randomText1Encoded, "result: \(result1) != expected: \(randomText1Encoded)")
let result2 = randomText2.base64Encoded
XCTAssertEqual(result2, randomText2Encoded, "result: \(result2) != expected: \(randomText2Encoded)")
let result3 = randomText3.base64Encoded
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??="
XCTAssertEqual(result, expected, "result: \(String(describing: result)) != expected: \(expected)")
}
}
// Mail
@@ -50,12 +76,12 @@ extension TestMiscellaneous {
}
func testMailHeaders() {
let headers = Mail(from: from, to: [to], cc: [to2], subject: "Test", text: text, additionalHeaders: ["key": "val"]).headers
let headers = Mail(from: from, to: [to], cc: [to2], subject: "Test", text: text, additionalHeaders: ["header": "val"]).headersString
let to_ = "TO: =?UTF-8?Q?Megaman?= <kiturasmtp@gmail.com>"
let to_ = "TO: =?UTF-8?Q?Megaman?= <\(email)>"
XCTAssert(headers.contains(to_), "Mail header did not contain \(to_)")
let cc_ = "CC: =?UTF-8?Q?Roll?= <kiturasmtp2@gmail.com>"
let cc_ = "CC: =?UTF-8?Q?Roll?= <\(email)>"
XCTAssert(headers.contains(cc_), "Mail header did not contain \(cc_)")
let subject = "SUBJECT: =?UTF-8?Q?Test?="
@@ -64,27 +90,38 @@ extension TestMiscellaneous {
let mimeVersion = "MIME-VERSION: 1.0 (Swift-SMTP)"
XCTAssert(headers.contains(mimeVersion), "Mail header did not contain \(mimeVersion)")
let additionalHeader = "KEY: val"
XCTAssert(headers.contains(additionalHeader), "Mail header did not contain \(additionalHeader)")
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\".")
}
func testTakeLast1() {
let arr = [a, b, ab]
let last = arr.takeLast { $0.contains("a") }.0
if let last = last {
XCTAssertEqual(last, ab, "result: \(last) != expected: \(ab)")
} else {
XCTFail()
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"
}
}
func testTakeLast2() {
let arr = [a, b, ab]
let last = arr.takeLast { $0.contains("b") }.0
if let last = last {
XCTAssertEqual(last, b, "result: \(last) != expected: \(b)")
} else {
XCTFail()
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
}
}
}
@@ -92,34 +129,14 @@ extension TestMiscellaneous {
// User
extension TestMiscellaneous {
func testMimeNoName() {
let user = User(email: "bob@gmail.com")
let user = Mail.User(email: "bob@gmail.com")
let expected = "bob@gmail.com"
XCTAssertEqual(user.mime, expected, "result: \(user.mime) != expected: \(expected)")
}
func testMimeWithName() {
let user = User(name: "Bob", email: "bob@gmail.com")
let user = Mail.User(name: "Bob", email: "bob@gmail.com")
let expected = "=?UTF-8?Q?Bob?= <bob@gmail.com>"
XCTAssertEqual(user.mime, expected, "result: \(user.mime) != expected: \(expected)")
}
}
// Utils
extension TestMiscellaneous {
func testBase64Encoded() {
let result1 = randomText1.base64Encoded
XCTAssertEqual(result1, randomText1Encoded, "result: \(result1) != expected: \(randomText1Encoded)")
let result2 = randomText2.base64Encoded
XCTAssertEqual(result2, randomText2Encoded, "result: \(result2) != expected: \(randomText2Encoded)")
let result3 = randomText3.base64Encoded
XCTAssertEqual(result3, randomText3Encoded, "result: \(result3) != expected: \(randomText3Encoded)")
}
func testMimeEncoded() {
let result = "Water you up to?".mimeEncoded
let expected = "=?UTF-8?Q?Water_you_up_to??="
XCTAssertEqual(result, expected, "result: \(String(describing: result)) != expected: \(expected)")
}
}
+133 -60
View File
@@ -18,82 +18,155 @@ import XCTest
@testable import SwiftSMTP
class TestSMTPSocket: XCTestCase {
static var allTests: [(String, (TestSMTPSocket) -> () throws -> Void)] {
return [
("testGetResponseCode", testGetResponseCode),
("testGetResponseCodeBadResponse", testGetResponseCodeBadResponse),
("testGetResponseCodeBlankReponse", testGetResponseCodeBlankReponse),
("testGetResponseMessageGood", testGetResponseMessageGood),
("testGetResponseMessageTooShort", testGetResponseMessageTooShort),
("testParseResponsesGood", testParseResponsesGood),
("testParseResponsesBad", testParseResponsesBad)
]
}
}
static var allTests = [
("testBadCredentials", testBadCredentials),
("testBadPort", testBadPort),
("testLogin", testLogin),
("testPlain", testPlain),
("testPort0", testPort0),
("testSSL", testSSL)
]
extension TestSMTPSocket {
func testGetResponseCode() throws {
let responseCode = try SMTPSocket.getResponseCode("250-smtp.gmail.com at your service, [66.68.56.204]", command: .ehlo(""))
let expected = ResponseCode(250)
XCTAssertEqual(responseCode, expected, "result: \(responseCode) != expected: \(expected)")
}
func testBadCredentials() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
func testGetResponseCodeBadResponse() {
do {
_ = try SMTPSocket.getResponseCode("250-SIZE 35882577", command: .starttls)
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: "bad password",
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
XCTFail()
x.fulfill()
} catch {
guard let err = error as? SMTPError, case .badResponse = err else {
XCTFail("Error should be SMTPError(.badResponse) but received no error or incorrect error.")
return
if case SMTPError.badResponse = error {
x.fulfill()
} else {
XCTFail(String(describing: error))
x.fulfill()
}
}
}
func testGetResponseCodeBlankReponse() {
func testBadPort() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket.getResponseCode("", command: .auth(.cramMD5, "credentials"))
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: 1,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: 5
)
XCTFail()
x.fulfill()
} catch {
guard let err = error as? SMTPError, case .badResponse = err else {
XCTFail("Error should be SMTPError(.badResponse) but received no error or incorrect error.")
return
}
x.fulfill()
}
}
}
extension TestSMTPSocket {
func testGetResponseMessageGood() {
let responseMessage = SMTPSocket.getResponseMessage("250 OK")
XCTAssertEqual(responseMessage, "OK", "result: \(responseMessage) != expected: \"OK\"")
}
func testLogin() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
func testGetResponseMessageTooShort() {
let responseMessage = SMTPSocket.getResponseMessage("NO")
XCTAssertEqual(responseMessage, "", "result: \(responseMessage) != expected: \"\"")
}
}
extension TestSMTPSocket {
func testParseResponsesGood() throws {
let ehloResponsesGood = "250 OK\(CRLF)250 GREAT\(CRLF)"
let responses = try SMTPSocket.parseResponses(ehloResponsesGood, command: .ehlo(domainName))
guard responses.count == 2 else {
XCTFail("Should return 2 responses but returned \(responses.count)")
return
}
XCTAssertEqual(responses[0].response, "250 OK", "First response: \(responses[0].response) != expected \"250 OK\"")
XCTAssertEqual(responses[1].response, "250 GREAT", "Second response: \(responses[1].response) != expected \"250 GREAT\"")
}
func testParseResponsesBad() {
let ehloResponsesBad = "999 BAD"
do {
_ = try SMTPSocket.parseResponses(ehloResponsesBad, command: .ehlo(domainName))
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: [AuthMethod.login.rawValue: .login],
domainName: domainName,
timeout: timeout
)
x.fulfill()
} catch {
guard let err = error as? SMTPError, case .badResponse = err else {
XCTFail("Should return SMTPError(.badResponse), but returned different error or no error.")
return
}
XCTFail(String(describing: error))
x.fulfill()
}
}
func testPlain() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: [AuthMethod.plain.rawValue: .plain],
domainName: domainName,
timeout: timeout
)
x.fulfill()
} catch {
XCTFail(String(describing: error))
x.fulfill()
}
}
func testPort0() throws {
let x = expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: 0,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
XCTFail()
x.fulfill()
} catch {
x.fulfill()
}
}
func testSSL() throws {
let x = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: tlsConfiguration,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
x.fulfill()
} catch {
XCTFail(String(describing: error))
x.fulfill()
}
}
}
+127
View File
@@ -0,0 +1,127 @@
/**
* Copyright IBM Corporation 2018
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import XCTest
@testable import SwiftSMTP
class TestTLSMode: XCTestCase {
static var allTests = [
("testNormal", testNormal),
/*("testIgnoreTLS", testIgnoreTLS),*/
("testRequireTLS", testRequireTLS),
("testRequireSTARTTLS", testRequireSTARTTLS)
]
func testNormal() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .normal,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
expectation.fulfill()
} catch {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
// This test is for a mail server that requires STARTTLS authentication. The current mail server being used for CI builds does not require STARTTLS for non-SSL ports. So this test cannot pass successfully.
/*
func testIgnoreTLS() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .ignoreTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
XCTFail()
expectation.fulfill()
} catch {
if case SMTPError.noAuthMethodsOrRequiresTLS = error {
expectation.fulfill()
} else {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
}
*/
func testRequireTLS() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: 465,
tlsMode: .requireTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
expectation.fulfill()
} catch {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
func testRequireSTARTTLS() {
let expectation = self.expectation(description: #function)
defer { waitForExpectations(timeout: testDuration) }
do {
_ = try SMTPSocket(
hostname: hostname,
email: email,
password: password,
port: portPlain,
tlsMode: .requireSTARTTLS,
tlsConfiguration: nil,
authMethods: authMethods,
domainName: domainName,
timeout: timeout
)
expectation.fulfill()
} catch {
XCTFail(String(describing: error))
expectation.fulfill()
}
}
}
@@ -1,61 +0,0 @@
/**
* Copyright IBM Corporation 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
#if os(OSX)
import XCTest
class VerifyLinuxTextCount: XCTestCase {
func verifyLinuxTextCount() {
var linuxCount: Int
var darwinCount: Int
// TestAttachment
linuxCount = TestAttachment.allTests.count
darwinCount = Int(TestAttachment.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestAttachment.allTests")
// TestAuthEncoder
linuxCount = TestAuthEncoder.allTests.count
darwinCount = Int(TestAuthEncoder.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestAuthEncoder.allTests")
// TestDataSender
linuxCount = TestDataSender.allTests.count
darwinCount = Int(TestDataSender.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestDataSender.allTests")
// TestLogin
linuxCount = TestLogin.allTests.count
darwinCount = Int(TestLogin.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestLogin.allTests")
// TestMiscellaneous
linuxCount = TestMiscellaneous.allTests.count
darwinCount = Int(TestMiscellaneous.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestMiscellaneous.allTests")
// TestSender
linuxCount = TestSender.allTests.count
darwinCount = Int(TestSender.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestSender.allTests")
// TestSMTPSocket
linuxCount = TestSMTPSocket.allTests.count
darwinCount = Int(TestSMTPSocket.defaultTestSuite().testCaseCount)
XCTAssertEqual(linuxCount, darwinCount, "\(darwinCount - linuxCount) tests are missing from TestSMTPSocket.allTests")
}
}
#endif
+28 -56
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enums Reference</title>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enums Reference"></a>
<a title="Enumerations Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Enums Reference
Enumerations Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Enums</h1>
<p>The following enums are available globally.</p>
<div class="section-content top-matter">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</div>
</section>
@@ -110,37 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP5Ports"></a>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP5Ports">Ports</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Common <code><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
<a href="Enums/Ports.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP10AuthMethod"></a>
<a name="/s:9SwiftSMTP10AuthMethodO"></a>
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP10AuthMethod">AuthMethod</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO">AuthMethod</a>
</code>
</div>
<div class="height-container">
@@ -156,23 +132,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP9SMTPError"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO"></a>
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP9SMTPError">SMTPError</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO">SMTPError</a>
</code>
</div>
<div class="height-container">
@@ -188,7 +160,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -203,8 +175,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+33 -41
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>AuthMethod Enum Reference</title>
<title>AuthMethod Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a title="AuthMethod Enum Reference"></a>
<a title="AuthMethod Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
AuthMethod Enum Reference
AuthMethod Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>AuthMethod</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_">cramMD5</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_">login</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_">plain</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_">xoauth2</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
</code>
</div>
<div class="height-container">
@@ -227,7 +219,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
</div>
</div>
@@ -242,8 +234,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
-188
View File
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ports Enum Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a title="Ports Enum Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Ports Enum Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Ports</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
<p>Common <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/tls" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_">tls</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Default <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">tls</span> <span class="o">=</span> <span class="mi">587</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3sslFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/ssl" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3sslFMS0_S0_">ssl</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p><code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> used to connect securely.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">ssl</span> <span class="o">=</span> <span class="mi">465</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>
+88 -128
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTPError Enum Reference</title>
<title>SMTPError Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a title="SMTPError Enum Reference"></a>
<a title="SMTPError Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTPError Enum Reference
SMTPError Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTPError</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FSSS0_"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FSSS0_">base64DecodeFail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail(string:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF">base64DecodeFail(string:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_">md5HashChallengeFail</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FSSS0_"></a>
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FSSS0_">fileNotFound</a>
<a name="/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/fileNotFound(path:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF">fileNotFound(path:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">fileNotFound</span><span class="p">(</span><span class="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_FTSSSi_S0_"></a>
<a name="//apple_ref/swift/Element/couldNotConnectToServer" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError23couldNotConnectToServerFMS0_FTSSSi_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">
@@ -220,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="kt">String</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_FSSS0_"></a>
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FSSS0_">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">
@@ -253,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="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">
@@ -324,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_FTSSSS_S0_"></a>
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FTSSSS_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">
@@ -355,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="kt">String</span><span class="p">,</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="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_FV10Foundation4DataS0_"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FV10Foundation4DataS0_">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">
@@ -386,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="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_FSSS0_"></a>
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FSSS0_">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">
@@ -410,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="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">
@@ -448,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>
@@ -463,8 +423,8 @@ without an access token.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+41 -80
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structs Reference</title>
<title>Structures Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
<a title="Structs Reference"></a>
<a title="Structures Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Structs Reference
Structures Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Structs</h1>
<p>The following structs are available globally.</p>
<div class="section-content top-matter">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP10Attachment"></a>
<a name="/s:9SwiftSMTP10AttachmentV"></a>
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP10Attachment">Attachment</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV">Attachment</a>
</code>
</div>
<div class="height-container">
@@ -120,7 +124,8 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a <code><a href="Structs/Mail.html">Mail</a></code>&lsquo;s attachment.</p>
<p>Represents a <code><a href="Structs/Mail.html">Mail</a></code>&lsquo;s attachment.
Different SMTP servers have different attachment size limits.</p>
<a href="Structs/Attachment.html" class="slightly-smaller">See more</a>
</div>
@@ -128,23 +133,20 @@
<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">
@@ -160,23 +162,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">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">
@@ -184,7 +182,7 @@
<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>
@@ -192,23 +190,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">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">
@@ -216,48 +210,15 @@
<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>
@@ -272,8 +233,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+105 -56
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Attachment Struct Reference</title>
<title>Attachment Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a title="Attachment Struct Reference"></a>
<a title="Attachment Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Attachment Struct Reference
Attachment Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,15 +100,18 @@
<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>
<p>Represents a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s attachment.</p>
<p>Represents a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s attachment.
Different SMTP servers have different attachment size limits.</p>
</div>
</section>
@@ -117,9 +123,9 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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">
@@ -134,7 +140,12 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span> <span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -151,7 +162,6 @@
<td>
<div>
<p>Raw data to be sent as attachment.</p>
</div>
</td>
</tr>
@@ -164,7 +174,6 @@
<td>
<div>
<p>MIME type of the data.</p>
</div>
</td>
</tr>
@@ -177,7 +186,6 @@
<td>
<div>
<p>File name which will be presented in the mail.</p>
</div>
</td>
</tr>
@@ -189,8 +197,9 @@
</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>
@@ -202,8 +211,11 @@
</td>
<td>
<div>
<p>Additional headers for the attachment. (optional)</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>
@@ -215,8 +227,8 @@
</td>
<td>
<div>
<p>Related <code>Attachment</code>s of this attachment. (optional)</p>
<p>Related <code>Attachment</code>s of this attachment. Defaults to
none.</p>
</div>
</td>
</tr>
@@ -229,9 +241,9 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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_6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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">
@@ -246,7 +258,12 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -263,7 +280,6 @@
<td>
<div>
<p>Path to the local file.</p>
</div>
</td>
</tr>
@@ -275,8 +291,8 @@
</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>
@@ -288,8 +304,8 @@
</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>
@@ -301,8 +317,9 @@
</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>
@@ -314,8 +331,9 @@
</td>
<td>
<div>
<p>Additional headers for the attachment. (optional)</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>
@@ -327,8 +345,8 @@
</td>
<td>
<div>
<p>Related <code>Attachment</code>s of this attachment. (optional)</p>
<p>Related <code>Attachment</code>s of this attachment. Defaults to
none.</p>
</div>
</td>
</tr>
@@ -341,9 +359,9 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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">
@@ -358,7 +376,11 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span> <span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -375,7 +397,6 @@
<td>
<div>
<p>Content string of HTML.</p>
</div>
</td>
</tr>
@@ -387,8 +408,8 @@
</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>
@@ -400,8 +421,8 @@
</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>
@@ -413,8 +434,9 @@
</td>
<td>
<div>
<p>Additional headers for the attachment. (optional)</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>
@@ -426,8 +448,8 @@
</td>
<td>
<div>
<p>Related <code>Attachment</code>s of this attachment. (optional)</p>
<p>Related <code>Attachment</code>s of this attachment. Defaults to
none.</p>
</div>
</td>
</tr>
@@ -437,6 +459,33 @@
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns <code>true</code> if the <code>Attachment</code>s are equal.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
@@ -445,8 +494,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+375 -41
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mail Struct Reference</title>
<title>Mail Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
<a title="Mail Struct Reference"></a>
<a title="Mail Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Mail Struct Reference
Mail Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Mail</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
</div>
</div>
@@ -117,9 +121,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">
@@ -127,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>
@@ -144,9 +148,308 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSqGSaS1___3bccGSqGSaS1___7subjectSS4textSS11attachmentsGSqGSaVS_10Attachment__17additionalHeadersGSqGVs10DictionarySSSS___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__2ccGSqGSaS1___3bccGSqGSaS1___7subjectSS4textSS11attachmentsGSqGSaVS_10Attachment__17additionalHeadersGSqGVs10DictionarySSSS___S0_">init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc">init(from:<wbr>to:<wbr>cc:<wbr>bcc:<wbr>subject:<wbr>text:<wbr>attachments:<wbr>additionalHeaders:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -161,7 +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="kc">nil</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="kc">nil</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="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -177,8 +487,7 @@
</td>
<td>
<div>
<p><code>User</code> to set the <code>Mail</code>s sender to.</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>
@@ -190,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>
@@ -203,8 +511,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to cc. (optional)</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -216,8 +523,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to bcc. (optional)</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -229,8 +535,7 @@
</td>
<td>
<div>
<p>Subject of the <code>Mail</code>. (optional)</p>
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
</div>
</td>
</tr>
@@ -242,8 +547,7 @@
</td>
<td>
<div>
<p>Text of the <code>Mail</code>. (optional)</p>
<p>Text of the <code>Mail</code>. Defaults to none.</p>
</div>
</td>
</tr>
@@ -255,8 +559,9 @@
</td>
<td>
<div>
<p>Array of <code>Attachment</code>s for the <code>Mail</code>. (optional)</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>
@@ -268,8 +573,9 @@
</td>
<td>
<div>
<p>Additional headers for the <code>Mail</code>. (optional)</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>
@@ -279,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>
@@ -287,8 +621,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+246
View File
@@ -0,0 +1,246 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
User Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4nameSSSgvp"></a>
<a name="//apple_ref/swift/Property/name" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4nameSSSgvp">name</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV5emailSSvp"></a>
<a name="//apple_ref/swift/Property/email" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV5emailSSvp">email</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s email address.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc">init(name:<wbr>email:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s email address.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
+113 -81
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTP Struct Reference</title>
<title>SMTP Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
<a title="SMTP Struct Reference"></a>
<a title="SMTP Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTP Struct Reference
SMTP Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,15 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTP</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
</div>
</div>
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
</div>
</section>
@@ -117,9 +121,37 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTPcFT8hostnameSS4userSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_"></a>
<a name="//apple_ref/swift/Method/init(hostname:user:password:port:ssl:authMethods:domainName:accessToken:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTPcFT8hostnameSS4userSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_">init(hostname:user: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">
@@ -128,12 +160,15 @@
<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>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.</p>
<p>Note:</p>
<ul>
<li>You may need to enable access for less secure apps for your account on the SMTP server.</li>
<li>Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.</li>
</ul>
</div>
@@ -142,8 +177,15 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</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">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">user</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="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="o">.</span><span class="n">defaultAuthMethods</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>
@@ -159,21 +201,19 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</td>
<td>
<div>
<p>Hostname of the SMTP server to connect to. Should not include any schemeie <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>
@@ -185,8 +225,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</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>
@@ -198,21 +237,32 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</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>
@@ -224,8 +274,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</td>
<td>
<div>
<p><code>AuthMethod</code>s to use to log in to the server. Defaults to all supported onescurrently <code>CRAM-MD5</code>, <code>LOGIN</code>, <code>PLAIN</code>, <code>XOAUTH2</code>.</p>
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. If blank, tries all supported methods.</p>
</div>
</td>
</tr>
@@ -238,20 +287,6 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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>.</p>
</div>
</td>
</tr>
@@ -264,7 +299,6 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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>
@@ -277,9 +311,9 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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">
@@ -294,7 +328,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</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">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -310,8 +344,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</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>
@@ -323,8 +356,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</td>
<td>
<div>
<p>Callback when sending finishes. <code>Error</code> is nil on success.</p>
<p>Callback when sending finishes. <code>Error</code> is nil on success. (optional)</p>
</div>
</td>
</tr>
@@ -337,9 +369,9 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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">
@@ -348,21 +380,19 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code>
are invalid, the entire mail will not send and return an
<code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s,
the whole sending process will not stop until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s
are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one.
To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them in separate calls to
<code>send</code>.</li>
<li>Each call to <code>send</code> will first log in to your server, attempt to send the mails, then closes the
connection. Pass in an array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send them all in one session.</li>
<li>If any of the email addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code> are invalid, the entire mail will not
send and return an <code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s, the whole sending process will continue
until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one. To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them
in separate calls to <code>send</code>.</li>
</ul>
</div>
@@ -372,7 +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>
@@ -388,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>
@@ -401,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>
@@ -414,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>
@@ -433,8 +465,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+242
View File
@@ -0,0 +1,242 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>TLSMode Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
<a title="TLSMode Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
TLSMode Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>TLSMode</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
</div>
</div>
<p>TLSMode enum for what form of connection security to enforce.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF"></a>
<a name="//apple_ref/swift/Element/normal" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF">normal</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">normal</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/ignoreTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF">ignoreTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ignoreTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF">requireTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireSTARTTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF">requireSTARTTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireSTARTTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
-300
View File
@@ -1,300 +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: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&rsquo;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>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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
View File
@@ -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&rsquo;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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
-190
View File
@@ -1,190 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Struct Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Struct Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
User Struct Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_">init(name:email:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>Display name for the user. Defaults to nil.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>Email address for the user.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>
+55 -23
View File
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Typealiases Reference</title>
<title>Type Aliases Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
<a title="Typealiases Reference"></a>
<a title="Type Aliases Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Typealiases Reference
Type Aliases Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Typealiases</h1>
<p>The following typealiases are available globally.</p>
<div class="section-content top-matter">
<h1>Type Aliases</h1>
<p>The following type aliases are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4Port"></a>
<a name="//apple_ref/swift/Alias/Port" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4Port">Port</a>
<a name="/s:9SwiftSMTP8Progressa"></a>
<a name="//apple_ref/swift/Alias/Progress" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP8Progressa">Progress</a>
</code>
</div>
<div class="height-container">
@@ -120,14 +124,42 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Port to connect to SMTP server with.</p>
<p>(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="Structs/Mail.html">Mail</a></code> is sent. <code><a href="Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is the error if it failed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Port</span> <span class="o">=</span> <span class="kt">Int32</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="p">((</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10Completiona"></a>
<a name="//apple_ref/swift/Alias/Completion" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10Completiona">Completion</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>([<code><a href="Structs/Mail.html">Mail</a></code>], [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="Structs/Mail.html">Mail</a></code>] is an array of successfully
sent <code><a href="Structs/Mail.html">Mail</a></code>s. [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="Structs/Mail.html">Mail</a></code>s and their corresponding <code>Error</code>s.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="p">(([</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">],</span> <span class="p">[(</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">)])</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
@@ -142,8 +174,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+28 -1
View File
@@ -1 +1,28 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="136" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h93v20H0z"/><path fill="#4c1" d="M93 0h43v20H93z"/><path fill="url(#b)" d="M0 0h136v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11"><text x="46.5" y="15" fill="#010101" fill-opacity=".3">documentation</text><text x="46.5" y="14">documentation</text><text x="113.5" y="15" fill="#010101" fill-opacity=".3">100%</text><text x="113.5" y="14">100%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="a">
<rect width="136" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#a)">
<path fill="#555" d="M0 0h93v20H0z"/>
<path fill="#4c1" d="M93 0h43v20H93z"/>
<path fill="url(#b)" d="M0 0h136v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="475" y="140" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
100%
</text>
<text x="1135" y="140" transform="scale(.1)" textLength="330">
100%
</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 807 B

After

Width:  |  Height:  |  Size: 1.1 KiB

+36 -9
View File
@@ -63,6 +63,10 @@ a {
a:hover, a:focus {
outline: 0;
text-decoration: underline; }
a.discouraged {
text-decoration: line-through; }
a.discouraged:hover, a.discouraged:focus {
text-decoration: underline line-through; }
table {
background: #fff;
@@ -90,10 +94,10 @@ pre {
code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
p > code, li > code {
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
background: #f7f7f7;
padding: .2em; }
p > code:before, p > code:after, li > code:before, li > code:after {
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
letter-spacing: -.2em;
content: "\00a0"; }
@@ -107,7 +111,6 @@ pre code {
@media (min-width: 768px) {
.content-wrapper {
flex-direction: row; } }
.header {
display: flex;
padding: 8px;
@@ -153,7 +156,6 @@ pre code {
word-wrap: normal;
background: #fbfbfb;
border-right: 1px solid #ddd; } }
.nav-groups {
list-style-type: none;
padding-left: 0; }
@@ -184,7 +186,6 @@ pre code {
order: 2;
flex: 1;
padding-bottom: 60px; } }
.section {
padding: 0 32px;
border-bottom: 1px solid #ddd; }
@@ -197,6 +198,8 @@ pre code {
.section-name {
color: #666;
display: block; }
.section-name p {
margin-bottom: inherit; }
.declaration .highlight {
overflow-x: initial;
@@ -215,6 +218,22 @@ pre code {
content: "";
display: block; }
.section-name-container {
position: relative; }
.section-name-container .section-name-link {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0; }
.section-name-container .section-name {
position: relative;
pointer-events: none;
z-index: 1; }
.section-name-container .section-name a {
pointer-events: auto; }
.item-container {
padding: 0; }
@@ -225,9 +244,11 @@ pre code {
.item a[name]:before {
content: "";
display: block; }
.item .token {
.item .token, .item .direct-link {
display: inline-block;
text-indent: -20px;
padding-left: 3px;
margin-left: 0px;
margin-left: 20px;
font-size: 1rem; }
.item .declaration-note {
font-size: .85em;
@@ -287,9 +308,9 @@ pre code {
.language .aside-title {
color: #4183c4; }
.aside-warning {
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
@@ -325,6 +346,7 @@ pre code {
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
display: none; }
html.dash .height-container {
display: block; }
@@ -338,14 +360,17 @@ form[role=search] input {
border-radius: 1em; }
.loading form[role=search] input {
background: white url(../img/spinner.gif) center right 4px no-repeat; }
form[role=search] .tt-menu {
margin: 0;
min-width: 300px;
background: #fbfbfb;
color: #333;
border: 1px solid #ddd; }
form[role=search] .tt-highlight {
font-weight: bold; }
form[role=search] .tt-suggestion {
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0 8px; }
@@ -358,11 +383,13 @@ form[role=search] .tt-suggestion {
font-weight: normal;
font-size: 0.9em;
padding-left: 16px; }
form[role=search] .tt-suggestion:hover,
form[role=search] .tt-suggestion.tt-cursor {
cursor: pointer;
background-color: #4183c4;
color: #fff; }
form[role=search] .tt-suggestion:hover .doc-parent-name,
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
color: #fff; }
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enums Reference</title>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enums Reference"></a>
<a title="Enumerations Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Enums Reference
Enumerations Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Enums</h1>
<p>The following enums are available globally.</p>
<div class="section-content top-matter">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</div>
</section>
@@ -110,37 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP5Ports"></a>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP5Ports">Ports</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Common <code><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
<a href="Enums/Ports.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP10AuthMethod"></a>
<a name="/s:9SwiftSMTP10AuthMethodO"></a>
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP10AuthMethod">AuthMethod</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO">AuthMethod</a>
</code>
</div>
<div class="height-container">
@@ -156,23 +132,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:O9SwiftSMTP9SMTPError"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO"></a>
<a name="//apple_ref/swift/Enum/SMTPError" class="dashAnchor"></a>
<a class="token" href="#/s:O9SwiftSMTP9SMTPError">SMTPError</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO">SMTPError</a>
</code>
</div>
<div class="height-container">
@@ -188,7 +160,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -203,8 +175,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>AuthMethod Enum Reference</title>
<title>AuthMethod Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Enum/AuthMethod" class="dashAnchor"></a>
<a title="AuthMethod Enum Reference"></a>
<a title="AuthMethod Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
AuthMethod Enum Reference
AuthMethod Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>AuthMethod</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span><span class="p">:</span> <span class="kt">String</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">AuthMethod</span> <span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF"></a>
<a name="//apple_ref/swift/Element/cramMD5" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7cramMD5FMS0_S0_">cramMD5</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7cramMD5yA2CmF">cramMD5</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cramMD5</span> <span class="o">=</span> <span class="s">"CRAM-MD5"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5loginyA2CmF"></a>
<a name="//apple_ref/swift/Element/login" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5loginFMS0_S0_">login</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5loginyA2CmF">login</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">login</span> <span class="o">=</span> <span class="s">"LOGIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO5plainyA2CmF"></a>
<a name="//apple_ref/swift/Element/plain" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod5plainFMS0_S0_">plain</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO5plainyA2CmF">plain</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">plain</span> <span class="o">=</span> <span class="s">"PLAIN"</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_"></a>
<a name="/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF"></a>
<a name="//apple_ref/swift/Element/xoauth2" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP10AuthMethod7xoauth2FMS0_S0_">xoauth2</a>
<a class="token" href="#/s:9SwiftSMTP10AuthMethodO7xoauth2yA2CmF">xoauth2</a>
</code>
</div>
<div class="height-container">
@@ -227,7 +219,7 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">xoauth2</span> <span class="o">=</span> <span class="s">"XOAUTH2"</span></code></pre>
</div>
</div>
@@ -242,8 +234,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ports Enum Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Ports" class="dashAnchor"></a>
<a title="Ports Enum Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Ports Enum Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Ports</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Ports</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></span></code></pre>
</div>
</div>
<p>Common <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>s.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/tls" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3tlsFMS0_S0_">tls</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Default <code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">tls</span> <span class="o">=</span> <span class="mi">587</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP5Ports3sslFMS0_S0_"></a>
<a name="//apple_ref/swift/Element/ssl" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP5Ports3sslFMS0_S0_">ssl</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p><code><a href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a></code> used to connect securely.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">ssl</span> <span class="o">=</span> <span class="mi">465</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTPError</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span><span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">SMTPError</span> <span class="p">:</span> <span class="kt">Error</span><span class="p">,</span> <span class="kt">CustomStringConvertible</span></code></pre>
</div>
</div>
@@ -117,9 +121,9 @@
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FSSS0_"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError16base64DecodeFailFMS0_FSSS0_">base64DecodeFail</a>
<a name="/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/base64DecodeFail(string:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO16base64DecodeFailyACSS_tcACmF">base64DecodeFail(string:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -134,23 +138,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">base64DecodeFail</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_"></a>
<a name="/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF"></a>
<a name="//apple_ref/swift/Element/md5HashChallengeFail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError20md5HashChallengeFailFMS0_S0_">md5HashChallengeFail</a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO20md5HashChallengeFailyA2CmF">md5HashChallengeFail</a>
</code>
</div>
<div class="height-container">
@@ -165,23 +165,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">md5HashChallengeFail</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FSSS0_"></a>
<a name="//apple_ref/swift/Element/fileNotFound" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12fileNotFoundFMS0_FSSS0_">fileNotFound</a>
<a name="/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF"></a>
<a name="//apple_ref/swift/Element/fileNotFound(path:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP9SMTPErrorO12fileNotFoundyACSS_tcACmF">fileNotFound(path:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -196,23 +192,19 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="nf">fileNotFound</span><span class="p">(</span><span class="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_FTSSSi_S0_"></a>
<a name="//apple_ref/swift/Element/couldNotConnectToServer" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError23couldNotConnectToServerFMS0_FTSSSi_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">
@@ -220,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="kt">String</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_FSSS0_"></a>
<a name="//apple_ref/swift/Element/noSupportedAuthMethods" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError22noSupportedAuthMethodsFMS0_FSSS0_">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">
@@ -253,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="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">
@@ -324,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_FTSSSS_S0_"></a>
<a name="//apple_ref/swift/Element/badResponse" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError11badResponseFMS0_FTSSSS_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">
@@ -355,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="kt">String</span><span class="p">,</span> <span class="kt">String</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="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_FV10Foundation4DataS0_"></a>
<a name="//apple_ref/swift/Element/convertDataUTF8Fail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError19convertDataUTF8FailFMS0_FV10Foundation4DataS0_">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">
@@ -386,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="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_FSSS0_"></a>
<a name="//apple_ref/swift/Element/invalidEmail" class="dashAnchor"></a>
<a class="token" href="#/s:FO9SwiftSMTP9SMTPError12invalidEmailFMS0_FSSS0_">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">
@@ -410,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="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">
@@ -448,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>
@@ -463,8 +423,8 @@ without an access token.</p>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structs Reference</title>
<title>Structures Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset="utf-8">
@@ -14,8 +14,9 @@
</head>
<body>
<a name="//apple_ref/swift/Section/Structures" class="dashAnchor"></a>
<a title="Structs Reference"></a>
<a title="Structures Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -32,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -43,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="index.html">SwiftSMTP Reference</a>
<img class="carat" src="img/carat.png" />
Structs Reference
Structures Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Structs</h1>
<p>The following structs are available globally.</p>
<div class="section-content top-matter">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:V9SwiftSMTP10Attachment"></a>
<a name="/s:9SwiftSMTP10AttachmentV"></a>
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a class="token" href="#/s:V9SwiftSMTP10Attachment">Attachment</a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV">Attachment</a>
</code>
</div>
<div class="height-container">
@@ -120,7 +124,8 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a <code><a href="Structs/Mail.html">Mail</a></code>&lsquo;s attachment.</p>
<p>Represents a <code><a href="Structs/Mail.html">Mail</a></code>&lsquo;s attachment.
Different SMTP servers have different attachment size limits.</p>
<a href="Structs/Attachment.html" class="slightly-smaller">See more</a>
</div>
@@ -128,23 +133,20 @@
<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">
@@ -160,23 +162,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">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">
@@ -184,7 +182,7 @@
<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>
@@ -192,23 +190,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">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">
@@ -216,48 +210,15 @@
<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>
@@ -272,8 +233,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Attachment Struct Reference</title>
<title>Attachment Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Attachment" class="dashAnchor"></a>
<a title="Attachment Struct Reference"></a>
<a title="Attachment Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Attachment Struct Reference
Attachment Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,15 +100,18 @@
<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>
<p>Represents a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s attachment.</p>
<p>Represents a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s attachment.
Different SMTP servers have different attachment size limits.</p>
</div>
</section>
@@ -117,9 +123,9 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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:FV9SwiftSMTP10AttachmentcFT4dataV10Foundation4Data4mimeSS4nameSS6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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">
@@ -134,7 +140,12 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">,</span> <span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -151,7 +162,6 @@
<td>
<div>
<p>Raw data to be sent as attachment.</p>
</div>
</td>
</tr>
@@ -164,7 +174,6 @@
<td>
<div>
<p>MIME type of the data.</p>
</div>
</td>
</tr>
@@ -177,7 +186,6 @@
<td>
<div>
<p>File name which will be presented in the mail.</p>
</div>
</td>
</tr>
@@ -189,8 +197,9 @@
</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>
@@ -202,8 +211,11 @@
</td>
<td>
<div>
<p>Additional headers for the attachment. (optional)</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>
@@ -215,8 +227,8 @@
</td>
<td>
<div>
<p>Related <code>Attachment</code>s of this attachment. (optional)</p>
<p>Related <code>Attachment</code>s of this attachment. Defaults to
none.</p>
</div>
</td>
</tr>
@@ -229,9 +241,9 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT8filePathSS4mimeSS4nameGSqSS_6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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_6inlineSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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">
@@ -246,7 +258,12 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">mime</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"application/octet-stream"</span><span class="p">,</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">inline</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -263,7 +280,6 @@
<td>
<div>
<p>Path to the local file.</p>
</div>
</td>
</tr>
@@ -275,8 +291,8 @@
</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>
@@ -288,8 +304,8 @@
</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>
@@ -301,8 +317,9 @@
</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>
@@ -314,8 +331,9 @@
</td>
<td>
<div>
<p>Additional headers for the attachment. (optional)</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>
@@ -327,8 +345,8 @@
</td>
<td>
<div>
<p>Related <code>Attachment</code>s of this attachment. (optional)</p>
<p>Related <code>Attachment</code>s of this attachment. Defaults to
none.</p>
</div>
</td>
</tr>
@@ -341,9 +359,9 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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:FV9SwiftSMTP10AttachmentcFT11htmlContentSS12characterSetSS11alternativeSb17additionalHeadersGSqGVs10DictionarySSSS__18relatedAttachmentsGSqGSaS0____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">
@@ -358,7 +376,11 @@
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">characterSet</span><span class="p">:</span> <span class="kt">String</span> <span class="o">=</span> <span class="s">"utf-8"</span><span class="p">,</span> <span class="nv">alternative</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kt">String</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -375,7 +397,6 @@
<td>
<div>
<p>Content string of HTML.</p>
</div>
</td>
</tr>
@@ -387,8 +408,8 @@
</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>
@@ -400,8 +421,8 @@
</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>
@@ -413,8 +434,9 @@
</td>
<td>
<div>
<p>Additional headers for the attachment. (optional)</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>
@@ -426,8 +448,8 @@
</td>
<td>
<div>
<p>Related <code>Attachment</code>s of this attachment. (optional)</p>
<p>Related <code>Attachment</code>s of this attachment. Defaults to
none.</p>
</div>
</td>
</tr>
@@ -437,6 +459,33 @@
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10AttachmentV2eeoiySbAC_ACtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns <code>true</code> if the <code>Attachment</code>s are equal.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">Attachment</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
@@ -445,8 +494,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mail Struct Reference</title>
<title>Mail Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/Mail" class="dashAnchor"></a>
<a title="Mail Struct Reference"></a>
<a title="Mail Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
Mail Struct Reference
Mail Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,11 +100,12 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>Mail</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Mail</span></code></pre>
</div>
</div>
@@ -117,9 +121,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">
@@ -127,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>
@@ -144,9 +148,308 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4MailcFT4fromVS_4User2toGSaS1__2ccGSqGSaS1___3bccGSqGSaS1___7subjectSS4textSS11attachmentsGSqGSaVS_10Attachment__17additionalHeadersGSqGVs10DictionarySSSS___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__2ccGSqGSaS1___3bccGSqGSaS1___7subjectSS4textSS11attachmentsGSqGSaVS_10Attachment__17additionalHeadersGSqGVs10DictionarySSSS___S0_">init(from:to:cc:bcc:subject:text:attachments:additionalHeaders:)</a>
<a class="token" href="#/s:9SwiftSMTP4MailV4from2to2cc3bcc7subject4text11attachments17additionalHeadersA2C4UserV_SayAMGA2NS2SSayAA10AttachmentVGSDyS2SGtcfc">init(from:<wbr>to:<wbr>cc:<wbr>bcc:<wbr>subject:<wbr>text:<wbr>attachments:<wbr>additionalHeaders:<wbr>)</a>
</code>
</div>
<div class="height-container">
@@ -161,7 +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="kc">nil</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="kc">nil</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="kc">nil</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="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="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>
@@ -177,8 +487,7 @@
</td>
<td>
<div>
<p><code>User</code> to set the <code>Mail</code>s sender to.</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>
@@ -190,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>
@@ -203,8 +511,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to cc. (optional)</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to cc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -216,8 +523,7 @@
</td>
<td>
<div>
<p>Array of <code>User</code>s to bcc. (optional)</p>
<p>Array of <code><a href="../Structs/Mail/User.html">User</a></code>s to bcc. Defaults to none.</p>
</div>
</td>
</tr>
@@ -229,8 +535,7 @@
</td>
<td>
<div>
<p>Subject of the <code>Mail</code>. (optional)</p>
<p>Subject of the <code>Mail</code>. Defaults to none.</p>
</div>
</td>
</tr>
@@ -242,8 +547,7 @@
</td>
<td>
<div>
<p>Text of the <code>Mail</code>. (optional)</p>
<p>Text of the <code>Mail</code>. Defaults to none.</p>
</div>
</td>
</tr>
@@ -255,8 +559,9 @@
</td>
<td>
<div>
<p>Array of <code>Attachment</code>s for the <code>Mail</code>. (optional)</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>
@@ -268,8 +573,9 @@
</td>
<td>
<div>
<p>Additional headers for the <code>Mail</code>. (optional)</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>
@@ -279,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>
@@ -287,8 +621,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -0,0 +1,246 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
User Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4nameSSSgvp"></a>
<a name="//apple_ref/swift/Property/name" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4nameSSSgvp">name</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV5emailSSvp"></a>
<a name="//apple_ref/swift/Property/email" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV5emailSSvp">email</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The user&rsquo;s email address.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">let</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4MailV4UserV4name5emailAESSSg_SStcfc">init(name:<wbr>email:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s name that is displayed in an email. Optional.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>The user&rsquo;s email address.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SMTP Struct Reference</title>
<title>SMTP Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
@@ -16,7 +16,7 @@
<a name="//apple_ref/swift/Struct/SMTP" class="dashAnchor"></a>
<a title="SMTP Struct Reference"></a>
<a title="SMTP Structure Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
@@ -33,7 +33,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
@@ -44,28 +44,25 @@
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
SMTP Struct Reference
SMTP Structure Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
@@ -73,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
<a class="nav-group-task-link" href="../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -97,15 +100,16 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<div class="section-content top-matter">
<h1>SMTP</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SMTP</span></code></pre>
</div>
</div>
<p>Represents a handle to connect to and send emails to an SMTP server.</p>
<p>Used to connect to an SMTP server and send emails.</p>
</div>
</section>
@@ -117,9 +121,37 @@
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4SMTPcFT8hostnameSS4userSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_"></a>
<a name="//apple_ref/swift/Method/init(hostname:user:password:port:ssl:authMethods:domainName:accessToken:timeout:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4SMTPcFT8hostnameSS4userSS8passwordSS4portVs5Int323sslGSqVS_3SSL_11authMethodsGSaOS_10AuthMethod_10domainNameSS11accessTokenGSqSS_7timeoutSi_S0_">init(hostname:user: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">
@@ -128,12 +160,15 @@
<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>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.</p>
<p>Note:</p>
<ul>
<li>You may need to enable access for less secure apps for your account on the SMTP server.</li>
<li>Some servers like Gmail support IPv6, and if your network does not, you will first attempt to connect via
IPv6, then timeout, and fall back to IPv4. You can avoid this by disabling IPv6 on your machine.</li>
</ul>
</div>
@@ -142,8 +177,15 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</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">hostname</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span> <span class="nv">user</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="kt"><a href="../Enums/AuthMethod.html">AuthMethod</a></span><span class="o">.</span><span class="n">defaultAuthMethods</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>
@@ -159,21 +201,19 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</td>
<td>
<div>
<p>Hostname of the SMTP server to connect to. Should not include any schemeie <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>
@@ -185,8 +225,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</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>
@@ -198,21 +237,32 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</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>
@@ -224,8 +274,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</td>
<td>
<div>
<p><code>AuthMethod</code>s to use to log in to the server. Defaults to all supported onescurrently <code>CRAM-MD5</code>, <code>LOGIN</code>, <code>PLAIN</code>, <code>XOAUTH2</code>.</p>
<p><code><a href="../Enums/AuthMethod.html">AuthMethod</a></code>s to use to log in to the server. If blank, tries all supported methods.</p>
</div>
</td>
</tr>
@@ -238,20 +287,6 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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>.</p>
</div>
</td>
</tr>
@@ -264,7 +299,6 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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>
@@ -277,9 +311,9 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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">
@@ -294,7 +328,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</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">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">send</span><span class="p">(</span><span class="n">_</span> <span class="nv">mail</span><span class="p">:</span> <span class="kt"><a href="../Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">((</span><span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
@@ -310,8 +344,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</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>
@@ -323,8 +356,7 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
</td>
<td>
<div>
<p>Callback when sending finishes. <code>Error</code> is nil on success.</p>
<p>Callback when sending finishes. <code>Error</code> is nil on success. (optional)</p>
</div>
</td>
</tr>
@@ -337,9 +369,9 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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">
@@ -348,21 +380,19 @@ back to IPv4. You can avoid this by disabling IPv6 on your machine.</p>
<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>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code>
are invalid, the entire mail will not send and return an
<code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s,
the whole sending process will not stop until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s
are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one.
To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them in separate calls to
<code>send</code>.</li>
<li>Each call to <code>send</code> will first log in to your server, attempt to send the mails, then closes the
connection. Pass in an array of <code><a href="../Structs/Mail.html">Mail</a></code>s to send them all in one session.</li>
<li>If any of the email addresses in a <code><a href="../Structs/Mail.html">Mail</a></code>&lsquo;s <code>to</code>, <code>cc</code>, or <code>bcc</code> are invalid, the entire mail will not
send and return an <code><a href="../Enums/SMTPError.html">SMTPError</a></code>.</li>
<li>If an individual <code><a href="../Structs/Mail.html">Mail</a></code> fails while sending an array of <code><a href="../Structs/Mail.html">Mail</a></code>s, the whole sending process will continue
until all pending <code><a href="../Structs/Mail.html">Mail</a></code>s are attempted.</li>
<li>Each call to <code>send</code> queues it&rsquo;s <code><a href="../Structs/Mail.html">Mail</a></code>s and sends them one by one. To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send them
in separate calls to <code>send</code>.</li>
</ul>
</div>
@@ -372,7 +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>
@@ -388,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>
@@ -401,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>
@@ -414,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>
@@ -433,8 +465,8 @@ To send <code><a href="../Structs/Mail.html">Mail</a></code>s concurrently, send
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -0,0 +1,242 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>TLSMode Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
<meta charset="utf-8">
<script src="../../js/jquery.min.js" defer></script>
<script src="../../js/jazzy.js" defer></script>
<script src="../../js/lunr.min.js" defer></script>
<script src="../../js/typeahead.jquery.js" defer></script>
<script src="../../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/TLSMode" class="dashAnchor"></a>
<a title="TLSMode Enumeration Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="../../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../../img/carat.png" />
TLSMode Enumeration Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../../Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content top-matter">
<h1>TLSMode</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">TLSMode</span></code></pre>
</div>
</div>
<p>TLSMode enum for what form of connection security to enforce.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF"></a>
<a name="//apple_ref/swift/Element/normal" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO6normalyA2EmF">normal</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">normal</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/ignoreTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO9ignoreTLSyA2EmF">ignoreTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ignoreTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO10requireTLSyA2EmF">requireTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF"></a>
<a name="//apple_ref/swift/Element/requireSTARTTLS" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP0B0V7TLSModeO15requireSTARTTLSyA2EmF">requireSTARTTLS</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">requireSTARTTLS</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,300 +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: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&rsquo;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>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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&rsquo;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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
</html>
@@ -1,190 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>User Struct Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset="utf-8">
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
<script src="../js/lunr.min.js" defer></script>
<script src="../js/typeahead.jquery.js" defer></script>
<script src="../js/jazzy.search.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/User" class="dashAnchor"></a>
<a title="User Struct Reference"></a>
<header class="header">
<p class="header-col header-col--primary">
<a class="header-link" href="../index.html">
SwiftSMTP Docs
</a>
(100% documented)
</p>
<p class="header-col--secondary">
<form role="search" action="../search.json">
<input type="text" placeholder="Search documentation" data-typeahead>
</form>
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<img class="header-icon" src="../img/gh.png"/>
View on GitHub
</a>
</p>
</header>
<p class="breadcrumbs">
<a class="breadcrumb" href="../index.html">SwiftSMTP Reference</a>
<img class="carat" src="../img/carat.png" />
User Struct Reference
</p>
<div class="content-wrapper">
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Structs.html">Structs</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Attachment.html">Attachment</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/SSL.html">SSL</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Structs/User.html">User</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="../Typealiases.html">Typealiases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="../Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>User</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">User</span></code></pre>
</div>
</div>
<p>Represents a sender or receiver of an email.</p>
</div>
</section>
<section class="section">
<div class="section-content">
<div class="task-group">
<ul class="item-container">
<li class="item">
<div>
<code>
<a name="/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_"></a>
<a name="//apple_ref/swift/Method/init(name:email:)" class="dashAnchor"></a>
<a class="token" href="#/s:FV9SwiftSMTP4UsercFT4nameGSqSS_5emailSS_S0_">init(name:email:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Initializes a <code>User</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">email</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>name</em>
</code>
</td>
<td>
<div>
<p>Display name for the user. Defaults to nil.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>email</em>
</code>
</td>
<td>
<div>
<p>Email address for the user.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</div>
</section>
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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,22 +70,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,9 +100,9 @@
<article class="main-content">
<section class="section">
<div class="section-content">
<h1>Typealiases</h1>
<p>The following typealiases are available globally.</p>
<div class="section-content top-matter">
<h1>Type Aliases</h1>
<p>The following type aliases are available globally.</p>
</div>
</section>
@@ -110,9 +114,9 @@
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP4Port"></a>
<a name="//apple_ref/swift/Alias/Port" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP4Port">Port</a>
<a name="/s:9SwiftSMTP8Progressa"></a>
<a name="//apple_ref/swift/Alias/Progress" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP8Progressa">Progress</a>
</code>
</div>
<div class="height-container">
@@ -120,14 +124,42 @@
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Port to connect to SMTP server with.</p>
<p>(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>) callback after each <code><a href="Structs/Mail.html">Mail</a></code> is sent. <code><a href="Structs/Mail.html">Mail</a></code> is the mail sent and <code>Error</code> is the error if it failed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Port</span> <span class="o">=</span> <span class="kt">Int32</span></code></pre>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Progress</span> <span class="o">=</span> <span class="p">((</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9SwiftSMTP10Completiona"></a>
<a name="//apple_ref/swift/Alias/Completion" class="dashAnchor"></a>
<a class="token" href="#/s:9SwiftSMTP10Completiona">Completion</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>([<code><a href="Structs/Mail.html">Mail</a></code>], [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)]) callback after all <code><a href="Structs/Mail.html">Mail</a></code>s have been attempted. [<code><a href="Structs/Mail.html">Mail</a></code>] is an array of successfully
sent <code><a href="Structs/Mail.html">Mail</a></code>s. [(<code><a href="Structs/Mail.html">Mail</a></code>, <code>Error</code>)] is an array of failed <code><a href="Structs/Mail.html">Mail</a></code>s and their corresponding <code>Error</code>s.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Completion</span> <span class="o">=</span> <span class="p">(([</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">],</span> <span class="p">[(</span><span class="kt"><a href="Structs/Mail.html">Mail</a></span><span class="p">,</span> <span class="kt">Error</span><span class="p">)])</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
</div>
</div>
@@ -142,8 +174,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -63,6 +63,10 @@ a {
a:hover, a:focus {
outline: 0;
text-decoration: underline; }
a.discouraged {
text-decoration: line-through; }
a.discouraged:hover, a.discouraged:focus {
text-decoration: underline line-through; }
table {
background: #fff;
@@ -90,10 +94,10 @@ pre {
code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; }
p > code, li > code {
.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code {
background: #f7f7f7;
padding: .2em; }
p > code:before, p > code:after, li > code:before, li > code:after {
.item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after {
letter-spacing: -.2em;
content: "\00a0"; }
@@ -107,7 +111,6 @@ pre code {
@media (min-width: 768px) {
.content-wrapper {
flex-direction: row; } }
.header {
display: flex;
padding: 8px;
@@ -153,7 +156,6 @@ pre code {
word-wrap: normal;
background: #fbfbfb;
border-right: 1px solid #ddd; } }
.nav-groups {
list-style-type: none;
padding-left: 0; }
@@ -184,7 +186,6 @@ pre code {
order: 2;
flex: 1;
padding-bottom: 60px; } }
.section {
padding: 0 32px;
border-bottom: 1px solid #ddd; }
@@ -197,6 +198,8 @@ pre code {
.section-name {
color: #666;
display: block; }
.section-name p {
margin-bottom: inherit; }
.declaration .highlight {
overflow-x: initial;
@@ -215,6 +218,22 @@ pre code {
content: "";
display: block; }
.section-name-container {
position: relative; }
.section-name-container .section-name-link {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0; }
.section-name-container .section-name {
position: relative;
pointer-events: none;
z-index: 1; }
.section-name-container .section-name a {
pointer-events: auto; }
.item-container {
padding: 0; }
@@ -225,9 +244,11 @@ pre code {
.item a[name]:before {
content: "";
display: block; }
.item .token {
.item .token, .item .direct-link {
display: inline-block;
text-indent: -20px;
padding-left: 3px;
margin-left: 0px;
margin-left: 20px;
font-size: 1rem; }
.item .declaration-note {
font-size: .85em;
@@ -287,9 +308,9 @@ pre code {
.language .aside-title {
color: #4183c4; }
.aside-warning {
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
@@ -325,6 +346,7 @@ pre code {
html.dash .header, html.dash .breadcrumbs, html.dash .navigation {
display: none; }
html.dash .height-container {
display: block; }
@@ -338,14 +360,17 @@ form[role=search] input {
border-radius: 1em; }
.loading form[role=search] input {
background: white url(../img/spinner.gif) center right 4px no-repeat; }
form[role=search] .tt-menu {
margin: 0;
min-width: 300px;
background: #fbfbfb;
color: #333;
border: 1px solid #ddd; }
form[role=search] .tt-highlight {
font-weight: bold; }
form[role=search] .tt-suggestion {
font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif;
padding: 0 8px; }
@@ -358,11 +383,13 @@ form[role=search] .tt-suggestion {
font-weight: normal;
font-size: 0.9em;
padding-left: 16px; }
form[role=search] .tt-suggestion:hover,
form[role=search] .tt-suggestion.tt-cursor {
cursor: pointer;
background-color: #4183c4;
color: #fff; }
form[role=search] .tt-suggestion:hover .doc-parent-name,
form[role=search] .tt-suggestion.tt-cursor .doc-parent-name {
color: #fff; }
@@ -32,7 +32,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -50,21 +50,18 @@
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +69,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,120 +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>Swift package for sending emails to an SMTP server.</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><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>Swift SMTP client.</p>
<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://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 &amp; 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 &amp; Linux: <code>Swift 4.0.3</code>, <code>Swift 4.1</code> and <code>Swift 4.1.2</code></p>
<h2 id='installation' class='heading'>Installation</h2>
<p>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&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<p>Create an <code><a href="Structs/Attachment.html">Attachment</a></code>, attach it to your <code><a href="Structs/Mail.html">Mail</a></code>, and send it through the <code><a href="Structs/SMTP.html">SMTP</a></code> handle. Here&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<pre class="highlight swift"><code><span class="c1">// Create a file `Attachment`</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// You can add "CONTENT-ID" to reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// "CONTENT-ID" lets you reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create an HTML `Attachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">])</span> <span class="c1">// to reference `fileAttachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="c1">// To reference `fileAttachment`</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create a data `Attachment`</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="s">"{</span><span class="se">\"</span><span class="s">key</span><span class="se">\"</span><span class="s">: </span><span class="se">\"</span><span class="s">hello world</span><span class="se">\"</span><span class="s">}"</span><span class="o">.</span><span class="nf">data</span><span class="p">(</span><span class="nv">using</span><span class="p">:</span> <span class="o">.</span><span class="n">utf8</span><span class="p">)</span><span class="o">!</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span><span class="p">)</span> <span class="c1">// send as a standalone attachment</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="c1">// send as a standalone attachment</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">)</span>
<span class="c1">// Create a `Mail` and include the `Attachment`s</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">])</span> <span class="c1">// attachments we created earlier</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="c1">// The attachments we created earlier</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Send the mail</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
<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>
@@ -222,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>
@@ -236,8 +288,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
@@ -8,26 +8,41 @@ if (navigator.userAgent.match(/xcode/i)) {
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
@@ -36,8 +51,20 @@ $(".token").click(function(event) {
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
// KaTeX rendering
if ("katex" in window) {
$($('.math').each( (_, element) => {
katex.render(element.textContent, element, {
displayMode: $(element).hasClass('m-block'),
throwOnError: false,
trust: true
});
}))
}
@@ -1,9 +1,4 @@
$(function(){
var searchIndex = lunr(function() {
this.ref('url');
this.field('name');
});
var $typeahead = $('[data-typeahead]');
var $form = $typeahead.parents('form');
var searchURL = $form.attr('action');
@@ -26,21 +21,34 @@ $(function(){
$form.addClass('loading');
$.getJSON(searchURL).then(function(searchData) {
$.each(searchData, function (url, doc) {
searchIndex.add({url: url, name: doc.name});
const searchIndex = lunr(function() {
this.ref('url');
this.field('name');
this.field('abstract');
for (const [url, doc] of Object.entries(searchData)) {
this.add({url: url, name: doc.name, abstract: doc.abstract});
}
});
$typeahead.typeahead(
{
highlight: true,
minLength: 3
minLength: 3,
autoselect: true
},
{
limit: 10,
display: displayTemplate,
templates: { suggestion: suggestionTemplate },
source: function(query, sync) {
var results = searchIndex.search(query).map(function(result) {
const lcSearch = query.toLowerCase();
const results = searchIndex.query(function(q) {
q.term(lcSearch, { boost: 100 });
q.term(lcSearch, {
boost: 10,
wildcard: lunr.Query.wildcard.TRAILING
});
}).map(function(result) {
var doc = searchData[result.ref];
doc.url = result.ref;
return doc;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,18 +1,19 @@
/*!
* typeahead.js 0.11.1
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* typeahead.js 1.3.1
* https://github.com/corejavascript/typeahead.js
* Copyright 2013-2020 Twitter, Inc. and other contributors; Licensed MIT
*/
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("typeahead.js", [ "jquery" ], function(a0) {
define([ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
@@ -148,6 +149,13 @@
stringify: function(val) {
return _.isString(val) ? val : JSON.stringify(val);
},
guid: function() {
function _p8(s) {
var p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return "tt-" + _p8() + _p8(true) + _p8(true) + _p8();
},
noop: function() {}
};
}();
@@ -189,7 +197,7 @@
function buildHtml(c) {
return {
wrapper: '<span class="' + c.wrapper + '"></span>',
menu: '<div class="' + c.menu + '"></div>'
menu: '<div role="listbox" class="' + c.menu + '"></div>'
};
}
function buildSelectors(classes) {
@@ -264,10 +272,8 @@
}
_.mixin(EventBus.prototype, {
_trigger: function(type, args) {
var $e;
$e = $.Event(namespace + type);
(args = args || []).unshift($e);
this.$el.trigger.apply(this.$el, args);
var $e = $.Event(namespace + type);
this.$el.trigger.call(this.$el, $e, args || []);
return $e;
},
before: function(type) {
@@ -384,7 +390,36 @@
tagName: "strong",
className: null,
wordsOnly: false,
caseSensitive: false
caseSensitive: false,
diacriticInsensitive: false
};
var accented = {
A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]",
B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]",
C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]",
D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]",
E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]",
F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]",
G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]",
H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]",
I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]",
J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]",
K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]",
L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]",
M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]",
N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]",
O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]",
P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]",
Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]",
R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]",
S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]",
T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]",
U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]",
V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]",
W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]",
X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]",
Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]",
Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]"
};
return function hightlight(o) {
var regex;
@@ -393,7 +428,7 @@
return;
}
o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive);
traverse(o.node, hightlightTextNode);
function hightlightTextNode(textNode) {
var match, patternNode, wrapperNode;
@@ -419,10 +454,17 @@
}
}
};
function getRegex(patterns, caseSensitive, wordsOnly) {
function accent_replacer(chr) {
return accented[chr.toUpperCase()] || chr;
}
function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) {
var escapedPatterns = [], regexStr;
for (var i = 0, len = patterns.length; i < len; i++) {
escapedPatterns.push(_.escapeRegExChars(patterns[i]));
var escapedWord = _.escapeRegExChars(patterns[i]);
if (diacriticInsensitive) {
escapedWord = escapedWord.replace(/\S/g, accent_replacer);
}
escapedPatterns.push(escapedWord);
}
regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
@@ -441,6 +483,7 @@
40: "down"
};
function Input(o, www) {
var id;
o = o || {};
if (!o.input) {
$.error("input is missing");
@@ -448,6 +491,18 @@
www.mixin(this);
this.$hint = $(o.hint);
this.$input = $(o.input);
this.$menu = $(o.menu);
id = this.$input.attr("id") || _.guid();
this.$menu.attr("id", id + "_listbox");
this.$hint.attr({
"aria-hidden": true
});
this.$input.attr({
"aria-owns": id + "_listbox",
role: "combobox",
"aria-autocomplete": "list",
"aria-expanded": false
});
this.query = this.$input.val();
this.queryWhenFocused = this.hasFocus() ? this.query : null;
this.$overflowHelper = buildOverflowHelper(this.$input);
@@ -455,6 +510,7 @@
if (this.$hint.length === 0) {
this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
}
this.onSync("cursorchange", this._updateDescendent);
}
Input.normalizeQuery = function(str) {
return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
@@ -524,6 +580,9 @@
this.trigger("whitespaceChanged", this.query);
}
},
_updateDescendent: function updateDescendent(event, id) {
this.$input.attr("aria-activedescendant", id);
},
bind: function() {
var that = this, onBlur, onFocus, onKeydown, onInput;
onBlur = _.bind(this._onBlur, this);
@@ -616,6 +675,9 @@
this.$input.off(".tt");
this.$overflowHelper.remove();
this.$hint = this.$input = this.$overflowHelper = $("<div>");
},
setAriaExpanded: function setAriaExpanded(value) {
this.$input.attr("aria-expanded", value);
}
});
return Input;
@@ -647,6 +709,7 @@
"use strict";
var keys, nameGenerator;
keys = {
dataset: "tt-selectable-dataset",
val: "tt-selectable-display",
obj: "tt-selectable-object"
};
@@ -666,19 +729,20 @@
}
www.mixin(this);
this.highlight = !!o.highlight;
this.name = o.name || nameGenerator();
this.name = _.toStr(o.name || nameGenerator());
this.limit = o.limit || 5;
this.displayFn = getDisplayFn(o.display || o.displayKey);
this.templates = getTemplates(o.templates, this.displayFn);
this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source;
this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async;
this._resetLastSuggestion();
this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
}
Dataset.extractData = function extractData(el) {
var $el = $(el);
if ($el.data(keys.obj)) {
return {
dataset: $el.data(keys.dataset) || "",
val: $el.data(keys.val) || "",
obj: $el.data(keys.obj) || null
};
@@ -697,7 +761,7 @@
} else {
this._empty();
}
this.trigger("rendered", this.name, suggestions, false);
this.trigger("rendered", suggestions, false, this.name);
},
_append: function append(query, suggestions) {
suggestions = suggestions || [];
@@ -708,7 +772,7 @@
} else if (!this.$lastSuggestion.length && this.templates.notFound) {
this._renderNotFound(query);
}
this.trigger("rendered", this.name, suggestions, true);
this.trigger("rendered", suggestions, true, this.name);
},
_renderSuggestions: function renderSuggestions(query, suggestions) {
var $fragment;
@@ -749,7 +813,7 @@
_.each(suggestions, function getSuggestionNode(suggestion) {
var $el, context;
context = that._injectQuery(query, suggestion);
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
$el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
fragment.appendChild($el[0]);
});
this.highlight && highlight({
@@ -787,7 +851,7 @@
this.cancel = function cancel() {
canceled = true;
that.cancel = $.noop;
that.async && that.trigger("asyncCanceled", query);
that.async && that.trigger("asyncCanceled", query, that.name);
};
this.source(query, sync, async);
!syncCalled && sync([]);
@@ -800,16 +864,17 @@
rendered = suggestions.length;
that._overwrite(query, suggestions);
if (rendered < that.limit && that.async) {
that.trigger("asyncRequested", query);
that.trigger("asyncRequested", query, that.name);
}
}
function async(suggestions) {
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
that.async && that.trigger("asyncReceived", query);
var idx = Math.abs(rendered - that.limit);
rendered += idx;
that._append(query, suggestions.slice(0, idx));
that.async && that.trigger("asyncReceived", query, that.name);
}
}
},
@@ -840,10 +905,14 @@
pending: templates.pending && _.templatify(templates.pending),
header: templates.header && _.templatify(templates.header),
footer: templates.footer && _.templatify(templates.footer),
suggestion: templates.suggestion || suggestionTemplate
suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate
};
function userSuggestionTemplate(context) {
var template = templates.suggestion;
return $(template(context)).attr("id", _.guid());
}
function suggestionTemplate(context) {
return $("<div>").text(displayFn(context));
return $('<div role="option">').attr("id", _.guid()).text(displayFn(context));
}
}
function isValidName(str) {
@@ -884,10 +953,11 @@
this.trigger.apply(this, arguments);
},
_allDatasetsEmpty: function allDatasetsEmpty() {
return _.every(this.datasets, isDatasetEmpty);
function isDatasetEmpty(dataset) {
return dataset.isEmpty();
}
return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) {
var isEmpty = dataset.isEmpty();
this.$node.attr("aria-expanded", !isEmpty);
return isEmpty;
}, this));
},
_getSelectables: function getSelectables() {
return this.$node.find(this.selectors.selectable);
@@ -912,6 +982,12 @@
var that = this, onSelectableClick;
onSelectableClick = _.bind(this._onSelectableClick, this);
this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
this.$node.on("mouseover", this.selectors.selectable, function() {
that.setCursor($(this));
});
this.$node.on("mouseleave", function() {
that._removeCursor();
});
_.each(this.datasets, function(dataset) {
dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that);
});
@@ -921,9 +997,11 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
this.$node.attr("aria-expanded", false);
this.$node.removeClass(this.classes.open);
this._removeCursor();
},
@@ -988,6 +1066,55 @@
});
return Menu;
}();
var Status = function() {
"use strict";
function Status(options) {
this.$el = $("<span></span>", {
role: "status",
"aria-live": "polite"
}).css({
position: "absolute",
padding: "0",
border: "0",
height: "1px",
width: "1px",
"margin-bottom": "-1px",
"margin-right": "-1px",
overflow: "hidden",
clip: "rect(0 0 0 0)",
"white-space": "nowrap"
});
options.$input.after(this.$el);
_.each(options.menu.datasets, _.bind(function(dataset) {
if (dataset.onSync) {
dataset.onSync("rendered", _.bind(this.update, this));
dataset.onSync("cleared", _.bind(this.cleared, this));
}
}, this));
}
_.mixin(Status.prototype, {
update: function update(event, suggestions) {
var length = suggestions.length;
var words;
if (length === 1) {
words = {
result: "result",
is: "is"
};
} else {
words = {
result: "results",
is: "are"
};
}
this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate.");
},
cleared: function() {
this.$el.text("");
}
});
return Status;
}();
var DefaultMenu = function() {
"use strict";
var s = Menu.prototype;
@@ -1052,6 +1179,7 @@
this.input = o.input;
this.menu = o.menu;
this.enabled = true;
this.autoselect = !!o.autoselect;
this.active = false;
this.input.hasFocus() && this.activate();
this.dir = this.input.getLangDir();
@@ -1098,8 +1226,12 @@
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
_onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) {
this._updateHint();
if (this.autoselect) {
var cursorClass = this.selectors.cursor.substr(1);
this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass);
}
this.eventBus.trigger("render", suggestions, async, dataset);
},
_onAsyncRequested: function onAsyncRequested(type, dataset, query) {
@@ -1122,15 +1254,25 @@
_onEnterKeyed: function onEnterKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
if (this.select($selectable)) {
$e.preventDefault();
$e.stopPropagation();
}
} else if (this.autoselect) {
if (this.select(this.menu.getTopSelectable())) {
$e.preventDefault();
$e.stopPropagation();
}
}
},
_onTabKeyed: function onTabKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
} else if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
} else if (this.autoselect) {
if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
}
}
},
_onEscKeyed: function onEscKeyed() {
@@ -1144,12 +1286,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
@@ -1226,6 +1368,7 @@
},
open: function open() {
if (!this.isOpen() && !this.eventBus.before("open")) {
this.input.setAriaExpanded(true);
this.menu.open();
this._updateHint();
this.eventBus.trigger("open");
@@ -1234,6 +1377,7 @@
},
close: function close() {
if (this.isOpen() && !this.eventBus.before("close")) {
this.input.setAriaExpanded(false);
this.menu.close();
this.input.clearHint();
this.input.resetInputValue();
@@ -1249,9 +1393,9 @@
},
select: function select($selectable) {
var data = this.menu.getSelectableData($selectable);
if (data && !this.eventBus.before("select", data.obj)) {
if (data && !this.eventBus.before("select", data.obj, data.dataset)) {
this.input.setQuery(data.val, true);
this.eventBus.trigger("select", data.obj);
this.eventBus.trigger("select", data.obj, data.dataset);
this.close();
return true;
}
@@ -1262,29 +1406,34 @@
query = this.input.getQuery();
data = this.menu.getSelectableData($selectable);
isValid = data && query !== data.val;
if (isValid && !this.eventBus.before("autocomplete", data.obj)) {
if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) {
this.input.setQuery(data.val);
this.eventBus.trigger("autocomplete", data.obj);
this.eventBus.trigger("autocomplete", data.obj, data.dataset);
return true;
}
return false;
},
moveCursor: function moveCursor(delta) {
var query, $candidate, data, payload, cancelMove;
var query, $candidate, data, suggestion, datasetName, cancelMove, id;
query = this.input.getQuery();
$candidate = this.menu.selectableRelativeToCursor(delta);
data = this.menu.getSelectableData($candidate);
payload = data ? data.obj : null;
suggestion = data ? data.obj : null;
datasetName = data ? data.dataset : null;
id = $candidate ? $candidate.attr("id") : null;
this.input.trigger("cursorchange", id);
cancelMove = this._minLengthMet() && this.menu.update(query);
if (!cancelMove && !this.eventBus.before("cursorchange", payload)) {
if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) {
this.menu.setCursor($candidate);
if (data) {
this.input.setInputValue(data.val);
if (typeof data.val === "string") {
this.input.setInputValue(data.val);
}
} else {
this.input.resetInputValue();
this._updateHint();
}
this.eventBus.trigger("cursorchange", payload);
this.eventBus.trigger("cursorchange", suggestion, datasetName);
return true;
}
return false;
@@ -1322,7 +1471,7 @@
www = WWW(o.classNames);
return this.each(attach);
function attach() {
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor;
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor;
_.each(datasets, function(d) {
d.highlight = !!o.highlight;
});
@@ -1347,17 +1496,23 @@
});
input = new Input({
hint: $hint,
input: $input
input: $input,
menu: $menu
}, www);
menu = new MenuConstructor({
node: $menu,
datasets: datasets
}, www);
status = new Status({
$input: $input,
menu: menu
});
typeahead = new Typeahead({
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength
minLength: o.minLength,
autoselect: o.autoselect
}, www);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
@@ -1450,7 +1605,7 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal));
});
return this;
}
@@ -1481,8 +1636,10 @@
});
}
function buildHintFromInput($input, www) {
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({
autocomplete: "off",
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({
readonly: true,
required: false
}).removeAttr("id name placeholder").removeClass("required").attr({
spellcheck: "false",
tabindex: -1
});
@@ -1495,7 +1652,6 @@
style: $input.attr("style")
});
$input.addClass(www.classes.input).attr({
autocomplete: "off",
spellcheck: false
});
try {
File diff suppressed because one or more lines are too long
@@ -1,6 +0,0 @@
{
"warnings": [
],
"source_directory": "/Users/quanvo/Projects/Swift-SMTP"
}
Binary file not shown.
+135 -83
View File
@@ -32,7 +32,7 @@
</p>
<p class="header-col header-col--secondary">
<a class="header-link" href="https://github.com/IBM-Swift/Swift-SMTP/">
<a class="header-link" href="https://github.com/Kitura/Swift-SMTP/">
<img class="header-icon" src="img/gh.png"/>
View on GitHub
</a>
@@ -50,21 +50,18 @@
<nav class="navigation">
<ul class="nav-groups">
<li class="nav-group-name">
<a class="nav-group-name-link" href="Enums.html">Enums</a>
<a class="nav-group-name-link" href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/AuthMethod.html">AuthMethod</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/Ports.html">Ports</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Enums/SMTPError.html">SMTPError</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Structs.html">Structs</a>
<a class="nav-group-name-link" href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Attachment.html">Attachment</a>
@@ -72,22 +69,28 @@
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail.html">Mail</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/Mail/User.html"> User</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SMTP.html">SMTP</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/SSL.html">SSL</a>
<a class="nav-group-task-link" href="Structs/SMTP/TLSMode.html"> TLSMode</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Structs/User.html">User</a>
<a class="nav-group-task-link" href="Structs/TLSConfiguration.html">TLSConfiguration</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a class="nav-group-name-link" href="Typealiases.html">Typealiases</a>
<a class="nav-group-name-link" href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP4Port">Port</a>
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP10Completiona">Completion</a>
</li>
<li class="nav-group-task">
<a class="nav-group-task-link" href="Typealiases.html#/s:9SwiftSMTP8Progressa">Progress</a>
</li>
</ul>
</li>
@@ -96,120 +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>Swift package for sending emails to an SMTP server.</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><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>Swift SMTP client.</p>
<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://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 &amp; 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 &amp; Linux: <code>Swift 4.0.3</code>, <code>Swift 4.1</code> and <code>Swift 4.1.2</code></p>
<h2 id='installation' class='heading'>Installation</h2>
<p>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&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<p>Create an <code><a href="Structs/Attachment.html">Attachment</a></code>, attach it to your <code><a href="Structs/Mail.html">Mail</a></code>, and send it through the <code><a href="Structs/SMTP.html">SMTP</a></code> handle. Here&rsquo;s an example of how you can send the three supported types of attachments&ndash;a local file, HTML, and raw data:</p>
<pre class="highlight swift"><code><span class="c1">// Create a file `Attachment`</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// You can add "CONTENT-ID" to reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">fileAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">filePath</span><span class="p">:</span> <span class="s">"~/img.png"</span><span class="p">,</span>
<span class="c1">// "CONTENT-ID" lets you reference this in another attachment</span>
<span class="nv">additionalHeaders</span><span class="p">:</span> <span class="p">[</span><span class="s">"CONTENT-ID"</span><span class="p">:</span> <span class="s">"img001"</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create an HTML `Attachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">])</span> <span class="c1">// to reference `fileAttachment`</span>
<span class="k">let</span> <span class="nv">htmlAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">htmlContent</span><span class="p">:</span> <span class="s">"&lt;html&gt;Here's an image: &lt;img src=</span><span class="se">\"</span><span class="s">cid:img001</span><span class="se">\"</span><span class="s">/&gt;&lt;/html&gt;"</span><span class="p">,</span>
<span class="c1">// To reference `fileAttachment`</span>
<span class="nv">related</span><span class="p">:</span> <span class="p">[</span><span class="n">fileAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Create a data `Attachment`</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="s">"{</span><span class="se">\"</span><span class="s">key</span><span class="se">\"</span><span class="s">: </span><span class="se">\"</span><span class="s">hello world</span><span class="se">\"</span><span class="s">}"</span><span class="o">.</span><span class="nf">data</span><span class="p">(</span><span class="nv">using</span><span class="p">:</span> <span class="o">.</span><span class="n">utf8</span><span class="p">)</span><span class="o">!</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span><span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span><span class="p">)</span> <span class="c1">// send as a standalone attachment</span>
<span class="k">let</span> <span class="nv">dataAttachment</span> <span class="o">=</span> <span class="kt">Attachment</span><span class="p">(</span>
<span class="nv">data</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span>
<span class="nv">mime</span><span class="p">:</span> <span class="s">"application/json"</span><span class="p">,</span>
<span class="nv">name</span><span class="p">:</span> <span class="s">"file.json"</span><span class="p">,</span>
<span class="c1">// send as a standalone attachment</span>
<span class="nv">inline</span><span class="p">:</span> <span class="kc">false</span>
<span class="p">)</span>
<span class="c1">// Create a `Mail` and include the `Attachment`s</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span><span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">])</span> <span class="c1">// attachments we created earlier</span>
<span class="k">let</span> <span class="nv">mail</span> <span class="o">=</span> <span class="kt">Mail</span><span class="p">(</span>
<span class="nv">from</span><span class="p">:</span> <span class="n">from</span><span class="p">,</span>
<span class="nv">to</span><span class="p">:</span> <span class="p">[</span><span class="n">to</span><span class="p">],</span>
<span class="nv">subject</span><span class="p">:</span> <span class="s">"Check out this image and JSON file!"</span><span class="p">,</span>
<span class="c1">// The attachments we created earlier</span>
<span class="nv">attachments</span><span class="p">:</span> <span class="p">[</span><span class="n">htmlAttachment</span><span class="p">,</span> <span class="n">dataAttachment</span><span class="p">]</span>
<span class="p">)</span>
<span class="c1">// Send the mail</span>
<span class="n">smtp</span><span class="o">.</span><span class="nf">send</span><span class="p">(</span><span class="n">mail</span><span class="p">)</span>
<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>
@@ -222,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>
@@ -236,8 +288,8 @@
</article>
</div>
<section class="footer">
<p>&copy; 2017 <a class="link" href="" target="_blank" rel="external">IBM</a>. All rights reserved. (Last updated: 2017-05-25)</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>&copy; 2020 <a class="link" href="" target="_blank" rel="external">IBM and Kitura project contributors</a>. All rights reserved. (Last updated: 2020-12-06)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.6</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</body>
</div>
+45 -18
View File
@@ -8,26 +8,41 @@ if (navigator.userAgent.match(/xcode/i)) {
window.jazzy.docset = true
}
// On doc load, toggle the URL hash discussion if present
$(document).ready(function() {
if (!window.jazzy.docset) {
var linkToHash = $('a[href="' + window.location.hash +'"]');
linkToHash.trigger("click");
}
});
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
// On token click, toggle its discussion and animate token.marginLeft
$(".token").click(function(event) {
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var link = $(this);
var animationDuration = 300;
$content = link.parent().parent().next();
$content.slideToggle(animationDuration);
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $(this).attr('href');
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
@@ -36,8 +51,20 @@ $(".token").click(function(event) {
event.preventDefault();
});
// Dumb down quotes within code blocks that delimit strings instead of quotations
// https://github.com/realm/jazzy/issues/714
$("code q").replaceWith(function () {
return ["\"", $(this).contents(), "\""];
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
// KaTeX rendering
if ("katex" in window) {
$($('.math').each( (_, element) => {
katex.render(element.textContent, element, {
displayMode: $(element).hasClass('m-block'),
throwOnError: false,
trust: true
});
}))
}
+17 -9
View File
@@ -1,9 +1,4 @@
$(function(){
var searchIndex = lunr(function() {
this.ref('url');
this.field('name');
});
var $typeahead = $('[data-typeahead]');
var $form = $typeahead.parents('form');
var searchURL = $form.attr('action');
@@ -26,21 +21,34 @@ $(function(){
$form.addClass('loading');
$.getJSON(searchURL).then(function(searchData) {
$.each(searchData, function (url, doc) {
searchIndex.add({url: url, name: doc.name});
const searchIndex = lunr(function() {
this.ref('url');
this.field('name');
this.field('abstract');
for (const [url, doc] of Object.entries(searchData)) {
this.add({url: url, name: doc.name, abstract: doc.abstract});
}
});
$typeahead.typeahead(
{
highlight: true,
minLength: 3
minLength: 3,
autoselect: true
},
{
limit: 10,
display: displayTemplate,
templates: { suggestion: suggestionTemplate },
source: function(query, sync) {
var results = searchIndex.search(query).map(function(result) {
const lcSearch = query.toLowerCase();
const results = searchIndex.query(function(q) {
q.term(lcSearch, { boost: 100 });
q.term(lcSearch, {
boost: 10,
wildcard: lunr.Query.wildcard.TRAILING
});
}).map(function(result) {
var doc = searchData[result.ref];
doc.url = result.ref;
return doc;
Vendored Executable → Regular
+2 -4
View File
File diff suppressed because one or more lines are too long
Vendored Executable → Regular
+3 -3
View File
File diff suppressed because one or more lines are too long
+209 -53
View File
@@ -1,18 +1,19 @@
/*!
* typeahead.js 0.11.1
* https://github.com/twitter/typeahead.js
* Copyright 2013-2015 Twitter, Inc. and other contributors; Licensed MIT
* typeahead.js 1.3.1
* https://github.com/corejavascript/typeahead.js
* Copyright 2013-2020 Twitter, Inc. and other contributors; Licensed MIT
*/
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define("typeahead.js", [ "jquery" ], function(a0) {
define([ "jquery" ], function(a0) {
return factory(a0);
});
} else if (typeof exports === "object") {
} else if (typeof module === "object" && module.exports) {
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
})(this, function($) {
var _ = function() {
@@ -148,6 +149,13 @@
stringify: function(val) {
return _.isString(val) ? val : JSON.stringify(val);
},
guid: function() {
function _p8(s) {
var p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return "tt-" + _p8() + _p8(true) + _p8(true) + _p8();
},
noop: function() {}
};
}();
@@ -189,7 +197,7 @@
function buildHtml(c) {
return {
wrapper: '<span class="' + c.wrapper + '"></span>',
menu: '<div class="' + c.menu + '"></div>'
menu: '<div role="listbox" class="' + c.menu + '"></div>'
};
}
function buildSelectors(classes) {
@@ -264,10 +272,8 @@
}
_.mixin(EventBus.prototype, {
_trigger: function(type, args) {
var $e;
$e = $.Event(namespace + type);
(args = args || []).unshift($e);
this.$el.trigger.apply(this.$el, args);
var $e = $.Event(namespace + type);
this.$el.trigger.call(this.$el, $e, args || []);
return $e;
},
before: function(type) {
@@ -384,7 +390,36 @@
tagName: "strong",
className: null,
wordsOnly: false,
caseSensitive: false
caseSensitive: false,
diacriticInsensitive: false
};
var accented = {
A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]",
B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]",
C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]",
D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]",
E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]",
F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]",
G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]",
H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]",
I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]",
J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]",
K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]",
L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]",
M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]",
N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]",
O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]",
P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]",
Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]",
R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]",
S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]",
T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]",
U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]",
V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]",
W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]",
X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]",
Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]",
Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]"
};
return function hightlight(o) {
var regex;
@@ -393,7 +428,7 @@
return;
}
o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ];
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly);
regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive);
traverse(o.node, hightlightTextNode);
function hightlightTextNode(textNode) {
var match, patternNode, wrapperNode;
@@ -419,10 +454,17 @@
}
}
};
function getRegex(patterns, caseSensitive, wordsOnly) {
function accent_replacer(chr) {
return accented[chr.toUpperCase()] || chr;
}
function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) {
var escapedPatterns = [], regexStr;
for (var i = 0, len = patterns.length; i < len; i++) {
escapedPatterns.push(_.escapeRegExChars(patterns[i]));
var escapedWord = _.escapeRegExChars(patterns[i]);
if (diacriticInsensitive) {
escapedWord = escapedWord.replace(/\S/g, accent_replacer);
}
escapedPatterns.push(escapedWord);
}
regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")";
return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i");
@@ -441,6 +483,7 @@
40: "down"
};
function Input(o, www) {
var id;
o = o || {};
if (!o.input) {
$.error("input is missing");
@@ -448,6 +491,18 @@
www.mixin(this);
this.$hint = $(o.hint);
this.$input = $(o.input);
this.$menu = $(o.menu);
id = this.$input.attr("id") || _.guid();
this.$menu.attr("id", id + "_listbox");
this.$hint.attr({
"aria-hidden": true
});
this.$input.attr({
"aria-owns": id + "_listbox",
role: "combobox",
"aria-autocomplete": "list",
"aria-expanded": false
});
this.query = this.$input.val();
this.queryWhenFocused = this.hasFocus() ? this.query : null;
this.$overflowHelper = buildOverflowHelper(this.$input);
@@ -455,6 +510,7 @@
if (this.$hint.length === 0) {
this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop;
}
this.onSync("cursorchange", this._updateDescendent);
}
Input.normalizeQuery = function(str) {
return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
@@ -524,6 +580,9 @@
this.trigger("whitespaceChanged", this.query);
}
},
_updateDescendent: function updateDescendent(event, id) {
this.$input.attr("aria-activedescendant", id);
},
bind: function() {
var that = this, onBlur, onFocus, onKeydown, onInput;
onBlur = _.bind(this._onBlur, this);
@@ -616,6 +675,9 @@
this.$input.off(".tt");
this.$overflowHelper.remove();
this.$hint = this.$input = this.$overflowHelper = $("<div>");
},
setAriaExpanded: function setAriaExpanded(value) {
this.$input.attr("aria-expanded", value);
}
});
return Input;
@@ -647,6 +709,7 @@
"use strict";
var keys, nameGenerator;
keys = {
dataset: "tt-selectable-dataset",
val: "tt-selectable-display",
obj: "tt-selectable-object"
};
@@ -666,19 +729,20 @@
}
www.mixin(this);
this.highlight = !!o.highlight;
this.name = o.name || nameGenerator();
this.name = _.toStr(o.name || nameGenerator());
this.limit = o.limit || 5;
this.displayFn = getDisplayFn(o.display || o.displayKey);
this.templates = getTemplates(o.templates, this.displayFn);
this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source;
this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async;
this._resetLastSuggestion();
this.$el = $(o.node).addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name);
}
Dataset.extractData = function extractData(el) {
var $el = $(el);
if ($el.data(keys.obj)) {
return {
dataset: $el.data(keys.dataset) || "",
val: $el.data(keys.val) || "",
obj: $el.data(keys.obj) || null
};
@@ -697,7 +761,7 @@
} else {
this._empty();
}
this.trigger("rendered", this.name, suggestions, false);
this.trigger("rendered", suggestions, false, this.name);
},
_append: function append(query, suggestions) {
suggestions = suggestions || [];
@@ -708,7 +772,7 @@
} else if (!this.$lastSuggestion.length && this.templates.notFound) {
this._renderNotFound(query);
}
this.trigger("rendered", this.name, suggestions, true);
this.trigger("rendered", suggestions, true, this.name);
},
_renderSuggestions: function renderSuggestions(query, suggestions) {
var $fragment;
@@ -749,7 +813,7 @@
_.each(suggestions, function getSuggestionNode(suggestion) {
var $el, context;
context = that._injectQuery(query, suggestion);
$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
$el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable);
fragment.appendChild($el[0]);
});
this.highlight && highlight({
@@ -787,7 +851,7 @@
this.cancel = function cancel() {
canceled = true;
that.cancel = $.noop;
that.async && that.trigger("asyncCanceled", query);
that.async && that.trigger("asyncCanceled", query, that.name);
};
this.source(query, sync, async);
!syncCalled && sync([]);
@@ -800,16 +864,17 @@
rendered = suggestions.length;
that._overwrite(query, suggestions);
if (rendered < that.limit && that.async) {
that.trigger("asyncRequested", query);
that.trigger("asyncRequested", query, that.name);
}
}
function async(suggestions) {
suggestions = suggestions || [];
if (!canceled && rendered < that.limit) {
that.cancel = $.noop;
rendered += suggestions.length;
that._append(query, suggestions.slice(0, that.limit - rendered));
that.async && that.trigger("asyncReceived", query);
var idx = Math.abs(rendered - that.limit);
rendered += idx;
that._append(query, suggestions.slice(0, idx));
that.async && that.trigger("asyncReceived", query, that.name);
}
}
},
@@ -840,10 +905,14 @@
pending: templates.pending && _.templatify(templates.pending),
header: templates.header && _.templatify(templates.header),
footer: templates.footer && _.templatify(templates.footer),
suggestion: templates.suggestion || suggestionTemplate
suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate
};
function userSuggestionTemplate(context) {
var template = templates.suggestion;
return $(template(context)).attr("id", _.guid());
}
function suggestionTemplate(context) {
return $("<div>").text(displayFn(context));
return $('<div role="option">').attr("id", _.guid()).text(displayFn(context));
}
}
function isValidName(str) {
@@ -884,10 +953,11 @@
this.trigger.apply(this, arguments);
},
_allDatasetsEmpty: function allDatasetsEmpty() {
return _.every(this.datasets, isDatasetEmpty);
function isDatasetEmpty(dataset) {
return dataset.isEmpty();
}
return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) {
var isEmpty = dataset.isEmpty();
this.$node.attr("aria-expanded", !isEmpty);
return isEmpty;
}, this));
},
_getSelectables: function getSelectables() {
return this.$node.find(this.selectors.selectable);
@@ -912,6 +982,12 @@
var that = this, onSelectableClick;
onSelectableClick = _.bind(this._onSelectableClick, this);
this.$node.on("click.tt", this.selectors.selectable, onSelectableClick);
this.$node.on("mouseover", this.selectors.selectable, function() {
that.setCursor($(this));
});
this.$node.on("mouseleave", function() {
that._removeCursor();
});
_.each(this.datasets, function(dataset) {
dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that);
});
@@ -921,9 +997,11 @@
return this.$node.hasClass(this.classes.open);
},
open: function open() {
this.$node.scrollTop(0);
this.$node.addClass(this.classes.open);
},
close: function close() {
this.$node.attr("aria-expanded", false);
this.$node.removeClass(this.classes.open);
this._removeCursor();
},
@@ -988,6 +1066,55 @@
});
return Menu;
}();
var Status = function() {
"use strict";
function Status(options) {
this.$el = $("<span></span>", {
role: "status",
"aria-live": "polite"
}).css({
position: "absolute",
padding: "0",
border: "0",
height: "1px",
width: "1px",
"margin-bottom": "-1px",
"margin-right": "-1px",
overflow: "hidden",
clip: "rect(0 0 0 0)",
"white-space": "nowrap"
});
options.$input.after(this.$el);
_.each(options.menu.datasets, _.bind(function(dataset) {
if (dataset.onSync) {
dataset.onSync("rendered", _.bind(this.update, this));
dataset.onSync("cleared", _.bind(this.cleared, this));
}
}, this));
}
_.mixin(Status.prototype, {
update: function update(event, suggestions) {
var length = suggestions.length;
var words;
if (length === 1) {
words = {
result: "result",
is: "is"
};
} else {
words = {
result: "results",
is: "are"
};
}
this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate.");
},
cleared: function() {
this.$el.text("");
}
});
return Status;
}();
var DefaultMenu = function() {
"use strict";
var s = Menu.prototype;
@@ -1052,6 +1179,7 @@
this.input = o.input;
this.menu = o.menu;
this.enabled = true;
this.autoselect = !!o.autoselect;
this.active = false;
this.input.hasFocus() && this.activate();
this.dir = this.input.getLangDir();
@@ -1098,8 +1226,12 @@
_onDatasetCleared: function onDatasetCleared() {
this._updateHint();
},
_onDatasetRendered: function onDatasetRendered(type, dataset, suggestions, async) {
_onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) {
this._updateHint();
if (this.autoselect) {
var cursorClass = this.selectors.cursor.substr(1);
this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass);
}
this.eventBus.trigger("render", suggestions, async, dataset);
},
_onAsyncRequested: function onAsyncRequested(type, dataset, query) {
@@ -1122,15 +1254,25 @@
_onEnterKeyed: function onEnterKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
if (this.select($selectable)) {
$e.preventDefault();
$e.stopPropagation();
}
} else if (this.autoselect) {
if (this.select(this.menu.getTopSelectable())) {
$e.preventDefault();
$e.stopPropagation();
}
}
},
_onTabKeyed: function onTabKeyed(type, $e) {
var $selectable;
if ($selectable = this.menu.getActiveSelectable()) {
this.select($selectable) && $e.preventDefault();
} else if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
} else if (this.autoselect) {
if ($selectable = this.menu.getTopSelectable()) {
this.autocomplete($selectable) && $e.preventDefault();
}
}
},
_onEscKeyed: function onEscKeyed() {
@@ -1144,12 +1286,12 @@
},
_onLeftKeyed: function onLeftKeyed() {
if (this.dir === "rtl" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onRightKeyed: function onRightKeyed() {
if (this.dir === "ltr" && this.input.isCursorAtEnd()) {
this.autocomplete(this.menu.getTopSelectable());
this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable());
}
},
_onQueryChanged: function onQueryChanged(e, query) {
@@ -1226,6 +1368,7 @@
},
open: function open() {
if (!this.isOpen() && !this.eventBus.before("open")) {
this.input.setAriaExpanded(true);
this.menu.open();
this._updateHint();
this.eventBus.trigger("open");
@@ -1234,6 +1377,7 @@
},
close: function close() {
if (this.isOpen() && !this.eventBus.before("close")) {
this.input.setAriaExpanded(false);
this.menu.close();
this.input.clearHint();
this.input.resetInputValue();
@@ -1249,9 +1393,9 @@
},
select: function select($selectable) {
var data = this.menu.getSelectableData($selectable);
if (data && !this.eventBus.before("select", data.obj)) {
if (data && !this.eventBus.before("select", data.obj, data.dataset)) {
this.input.setQuery(data.val, true);
this.eventBus.trigger("select", data.obj);
this.eventBus.trigger("select", data.obj, data.dataset);
this.close();
return true;
}
@@ -1262,29 +1406,34 @@
query = this.input.getQuery();
data = this.menu.getSelectableData($selectable);
isValid = data && query !== data.val;
if (isValid && !this.eventBus.before("autocomplete", data.obj)) {
if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) {
this.input.setQuery(data.val);
this.eventBus.trigger("autocomplete", data.obj);
this.eventBus.trigger("autocomplete", data.obj, data.dataset);
return true;
}
return false;
},
moveCursor: function moveCursor(delta) {
var query, $candidate, data, payload, cancelMove;
var query, $candidate, data, suggestion, datasetName, cancelMove, id;
query = this.input.getQuery();
$candidate = this.menu.selectableRelativeToCursor(delta);
data = this.menu.getSelectableData($candidate);
payload = data ? data.obj : null;
suggestion = data ? data.obj : null;
datasetName = data ? data.dataset : null;
id = $candidate ? $candidate.attr("id") : null;
this.input.trigger("cursorchange", id);
cancelMove = this._minLengthMet() && this.menu.update(query);
if (!cancelMove && !this.eventBus.before("cursorchange", payload)) {
if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) {
this.menu.setCursor($candidate);
if (data) {
this.input.setInputValue(data.val);
if (typeof data.val === "string") {
this.input.setInputValue(data.val);
}
} else {
this.input.resetInputValue();
this._updateHint();
}
this.eventBus.trigger("cursorchange", payload);
this.eventBus.trigger("cursorchange", suggestion, datasetName);
return true;
}
return false;
@@ -1322,7 +1471,7 @@
www = WWW(o.classNames);
return this.each(attach);
function attach() {
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, typeahead, MenuConstructor;
var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor;
_.each(datasets, function(d) {
d.highlight = !!o.highlight;
});
@@ -1347,17 +1496,23 @@
});
input = new Input({
hint: $hint,
input: $input
input: $input,
menu: $menu
}, www);
menu = new MenuConstructor({
node: $menu,
datasets: datasets
}, www);
status = new Status({
$input: $input,
menu: menu
});
typeahead = new Typeahead({
input: input,
menu: menu,
eventBus: eventBus,
minLength: o.minLength
minLength: o.minLength,
autoselect: o.autoselect
}, www);
$input.data(keys.www, www);
$input.data(keys.typeahead, typeahead);
@@ -1450,7 +1605,7 @@
return query;
} else {
ttEach(this, function(t) {
t.setVal(newVal);
t.setVal(_.toStr(newVal));
});
return this;
}
@@ -1481,8 +1636,10 @@
});
}
function buildHintFromInput($input, www) {
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop("readonly", true).removeAttr("id name placeholder required").attr({
autocomplete: "off",
return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({
readonly: true,
required: false
}).removeAttr("id name placeholder").removeClass("required").attr({
spellcheck: "false",
tabindex: -1
});
@@ -1495,7 +1652,6 @@
style: $input.attr("style")
});
$input.addClass(www.classes.input).attr({
autocomplete: "off",
spellcheck: false
});
try {
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2,5 +2,5 @@
"warnings": [
],
"source_directory": "/Users/quanvo/Projects/Swift-SMTP"
"source_directory": "/Users/dannys/projects/kitura/Swift-SMTP"
}
+90
View File
@@ -0,0 +1,90 @@
# 5.0.0 Migration Guide
- The default port is now `587`.
- The `SMTP` struct is now initialized with a `TLSMode` enum instead of a `useTLS` Bool, allowing more configuration options:
```swift
/// TLSMode enum for what form of connection security to enforce.
public enum TLSMode {
/// Upgrades the connection to TLS if STARTLS command is received, else sends mail without security.
case normal
/// Send mail over plaintext and ignore STARTTLS commands and TLS options. Could throw an error if server requires TLS.
case ignoreTLS
/// Only send mail after an initial successful TLS connection. Connection will fail if a TLS connection cannot be established. The default port, 587, will likely need to be adjusted depending on your server.
case requireTLS
/// Expect a STARTTLS command from the server and require the connection is upgraded to TLS. Will throw if the server does not issue a STARTTLS command.
case requireSTARTTLS
}
```
# 4.0.0 Migration Guide
- `User` struct now nested in `Mail` struct to avoid namespace issues [(69)](https://github.com/Kitura/Swift-SMTP/pull/69). Create a user like so:
```swift
let sender = Mail.User(name: "Sloth", email: "sloth@gmail.com")
```
- `User` properties are now public
- The optional `accessToken` parameter of the `SMTP` struct has been removed. If you are using the authorization method `XOAUTH2`, pass in your access token in the `password` parameter instead. For example:
```swift
let smtp = SMTP(
hostname: "smtp.gmail.com",
email: "example@gmail.com",
password: "accessToken",
authMethods: [.xoauth2]
)
```
- Fixed a bug where the wrong `Attachment` was used an an alternative to text content when a `Mail` was initialized with multiple `Attachment`s [(67)](https://github.com/Kitura/Swift-SMTP/pull/67)
# 3.0.0 Migration Guide
## Initialize `SMTP`
Before `3.0.0`:
```swift
public init(hostname: String,
email: String,
password: String,
port: Port = Ports.tls.rawValue,
ssl: SSL? = nil,
authMethods: [AuthMethod] = [],
domainName: String = "localhost",
accessToken: String? = nil,
timeout: UInt = 10)
```
After `3.0.0`:
```swift
public init(hostname: String,
email: String,
password: String,
port: Int32 = 465,
useTLS: Bool = true,
tlsConfiguration: TLSConfiguration? = nil,
authMethods: [AuthMethod] = [],
accessToken: String? = nil,
domainName: String = "localhost",
timeout: UInt = 10)
```
## Renamed
- `SSL` renamed to `TLSConfiguration`
## Removed
- `Port` typealias
## Other Changes
- `Mail` properties are now public