Merge pull request #1135 from BlackDex/update-mail

Updated lettre (and other crates) and workflow.
This commit is contained in:
Daniel García 2020-09-13 15:08:01 +02:00 committed by GitHub
commit ea15218197
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 139 additions and 172 deletions

217
Cargo.lock generated
View file

@ -146,7 +146,7 @@ dependencies = [
"libsqlite3-sys",
"log 0.4.11",
"multipart",
"native-tls",
"newline-converter",
"num-derive",
"num-traits",
"oath",
@ -167,7 +167,7 @@ dependencies = [
"soup",
"structopt",
"syslog",
"time 0.2.16",
"time 0.2.18",
"u2f",
"uuid",
"ws",
@ -205,12 +205,6 @@ dependencies = [
"safemem",
]
[[package]]
name = "bufstream"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8"
[[package]]
name = "bumpalo"
version = "3.4.0"
@ -327,6 +321,12 @@ dependencies = [
"bitflags",
]
[[package]]
name = "const_fn"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2"
[[package]]
name = "constant_time_eq"
version = "0.1.5"
@ -340,7 +340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c60ef6d0bbf56ad2674249b6bb74f2c6aeb98b98dd57b5d3e37cace33011d69"
dependencies = [
"percent-encoding 2.1.0",
"time 0.2.16",
"time 0.2.18",
]
[[package]]
@ -417,9 +417,9 @@ version = "0.3.0"
source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089"
dependencies = [
"bitflags",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -445,9 +445,9 @@ version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -679,9 +679,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
dependencies = [
"proc-macro-hack",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -740,9 +740,9 @@ dependencies = [
[[package]]
name = "getrandom"
version = "0.1.14"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
dependencies = [
"cfg-if",
"libc",
@ -797,12 +797,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.8.2"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25"
dependencies = [
"autocfg 1.0.1",
]
checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
[[package]]
name = "heck"
@ -1005,9 +1002,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.5.1"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9"
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
dependencies = [
"autocfg 1.0.1",
"hashbrown",
@ -1062,9 +1059,9 @@ checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
[[package]]
name = "js-sys"
version = "0.3.44"
version = "0.3.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85a7e2c92a4804dd459b86c339278d0fe87cf93757fae222c3fa3ae75458bc73"
checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8"
dependencies = [
"wasm-bindgen",
]
@ -1113,24 +1110,22 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "lettre"
version = "0.10.0-alpha.1"
version = "0.10.0-alpha.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "deaf9b74d40fcb52d0f762eb08e45d5152b4db59d29bb73edd4cac7fe796862c"
checksum = "8ef0e6a22631e37078148cff6ce1ef92984bdc2fbd2cb2cc804836db8196cc57"
dependencies = [
"base64 0.12.3",
"bufstream",
"hostname",
"hyperx",
"idna 0.2.0",
"line-wrap",
"mime 0.3.16",
"native-tls",
"nom",
"once_cell",
"quoted_printable",
"rand 0.7.3",
"regex",
"serde",
"textnonce",
"uuid",
]
@ -1149,9 +1144,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.76"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3"
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
[[package]]
name = "libsqlite3-sys"
@ -1164,15 +1159,6 @@ dependencies = [
"vcpkg",
]
[[package]]
name = "line-wrap"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
dependencies = [
"safemem",
]
[[package]]
name = "lock_api"
version = "0.4.1"
@ -1268,9 +1254,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c"
dependencies = [
"migrations_internals",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -1398,9 +1384,9 @@ dependencies = [
[[package]]
name = "net2"
version = "0.2.34"
version = "0.2.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853"
dependencies = [
"cfg-if",
"libc",
@ -1413,6 +1399,12 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "newline-converter"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff9ae3574d1a57e937b8789201c223501e8178b4b42849d7b1a40d2cb2592a51"
[[package]]
name = "nodrop"
version = "0.1.14"
@ -1465,9 +1457,9 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f09b9841adb6b5e1f89ef7087ea636e0fd94b2851f887c1e3eb5d5f8228fab3"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -1707,9 +1699,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -1776,9 +1768,9 @@ version = "0.4.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -1827,9 +1819,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
"version_check 0.9.2",
]
@ -1839,7 +1831,7 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"version_check 0.9.2",
]
@ -1867,9 +1859,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.19"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12"
checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
dependencies = [
"unicode-xid 0.2.1",
]
@ -1901,7 +1893,7 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
]
[[package]]
@ -2208,7 +2200,7 @@ dependencies = [
"rocket_codegen",
"rocket_http",
"state",
"time 0.2.16",
"time 0.2.18",
"toml",
"version_check 0.9.2",
"yansi",
@ -2254,7 +2246,7 @@ dependencies = [
"rustls",
"smallvec 1.4.2",
"state",
"time 0.2.16",
"time 0.2.18",
"unicode-xid 0.2.1",
]
@ -2388,22 +2380,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.115"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5"
checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.115"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48"
checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -2513,9 +2505,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
[[package]]
name = "socket2"
version = "0.3.12"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44"
dependencies = [
"cfg-if",
"libc",
@ -2586,11 +2578,11 @@ version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"serde",
"serde_derive",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -2600,13 +2592,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11"
dependencies = [
"base-x",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"serde",
"serde_derive",
"serde_json",
"sha1",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -2638,7 +2630,7 @@ checksum = "f0f45ed1b65bf9a4bf2f7b7dc59212d1926e9eaf00fa998988e420fd124467c6"
dependencies = [
"phf_generator",
"phf_shared",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"string_cache_shared",
]
@ -2674,9 +2666,9 @@ checksum = "5e2513111825077552a6751dfad9e11ce0fba07d7276a3943a037d7e93e64c5f"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -2687,9 +2679,9 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
[[package]]
name = "subtle"
version = "2.2.3"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1"
checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"
[[package]]
name = "syn"
@ -2704,11 +2696,11 @@ dependencies = [
[[package]]
name = "syn"
version = "1.0.39"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9"
checksum = "963f7d3cc59b59b9325165add223142bbf1df27655d07789f109896d353d8350"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"unicode-xid 0.2.1",
]
@ -2750,19 +2742,6 @@ dependencies = [
"utf-8",
]
[[package]]
name = "textnonce"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acc659075a12c12c07bbb384862c352506707f6597f5b495f65427d08519b617"
dependencies = [
"base64 0.12.3",
"byteorder",
"chrono",
"rand 0.7.3",
"serde",
]
[[package]]
name = "textwrap"
version = "0.11.0"
@ -2803,11 +2782,11 @@ dependencies = [
[[package]]
name = "time"
version = "0.2.16"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15"
checksum = "12785163ae8a1cbb52a5db39af4a5baabd3fe49f07f76f952f89d7e89e5ce531"
dependencies = [
"cfg-if",
"const_fn",
"libc",
"standback",
"stdweb",
@ -2833,10 +2812,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa"
dependencies = [
"proc-macro-hack",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"standback",
"syn 1.0.39",
"syn 1.0.40",
]
[[package]]
@ -2915,9 +2894,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.15"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f0e00789804e99b20f12bc7003ca416309d28a6f495d6af58d1e2c2842461b5"
checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a"
dependencies = [
"lazy_static",
]
@ -3140,9 +3119,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.67"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0563a9a4b071746dd5aedbc3a28c6fe9be4586fb3fbadb67c400d4f53c6b16c"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
dependencies = [
"cfg-if",
"serde",
@ -3152,24 +3131,24 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.67"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc71e4c5efa60fb9e74160e89b93353bc24059999c0ae0fb03affc39770310b0"
checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68"
dependencies = [
"bumpalo",
"lazy_static",
"log 0.4.11",
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.17"
version = "0.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95f8d235a77f880bcef268d379810ea6c0af2eacfa90b1ad5af731776e0c4699"
checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da"
dependencies = [
"cfg-if",
"js-sys",
@ -3179,9 +3158,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.67"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97c57cefa5fa80e2ba15641578b44d36e7a64279bc5ed43c6dbaf329457a2ed2"
checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038"
dependencies = [
"quote 1.0.7",
"wasm-bindgen-macro-support",
@ -3189,28 +3168,28 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.67"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556"
checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe"
dependencies = [
"proc-macro2 1.0.19",
"proc-macro2 1.0.21",
"quote 1.0.7",
"syn 1.0.39",
"syn 1.0.40",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.67"
version = "0.2.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93b162580e34310e5931c4b792560108b10fd14d64915d7fff8ff00180e70092"
checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307"
[[package]]
name = "web-sys"
version = "0.3.44"
version = "0.3.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dda38f4e5ca63eda02c059d243aa25b5f35ab98451e518c51612cd0f1bd19a47"
checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d"
dependencies = [
"js-sys",
"wasm-bindgen",
@ -3334,7 +3313,7 @@ dependencies = [
"rand 0.6.5",
"reqwest",
"sha-1 0.8.2",
"subtle 2.2.3",
"subtle 2.3.0",
"threadpool",
"url 1.7.2",
]

View file

@ -18,7 +18,7 @@ postgresql = ["diesel/postgres", "diesel_migrations/postgres"]
sqlite = ["diesel/sqlite", "diesel_migrations/sqlite", "libsqlite3-sys"]
# Enable unstable features, requires nightly
# Currently only used to enable rusts official ip support
# Currently only used to enable rusts official ip support
unstable = []
[target."cfg(not(windows))".dependencies]
@ -30,7 +30,7 @@ rocket = { version = "0.5.0-dev", features = ["tls"], default-features = false }
rocket_contrib = "0.5.0-dev"
# HTTP client
reqwest = { version = "0.10.7", features = ["blocking", "json"] }
reqwest = { version = "0.10.8", features = ["blocking", "json"] }
# multipart/form-data support
multipart = { version = "0.17.0", features = ["server"], default-features = false }
@ -45,8 +45,8 @@ rmpv = "0.4.5"
chashmap = "2.2.2"
# A generic serialization/deserialization framework
serde = "1.0.115"
serde_derive = "1.0.115"
serde = "1.0.116"
serde_derive = "1.0.116"
serde_json = "1.0.57"
# Logging
@ -68,9 +68,9 @@ ring = "0.16.15"
uuid = { version = "0.8.1", features = ["v4"] }
# Date and time libraries
chrono = "0.4.13"
chrono-tz = "0.5.2"
time = "0.2.16"
chrono = "0.4.15"
chrono-tz = "0.5.3"
time = "0.2.18"
# TOTP library
oath = "0.10.2"
@ -91,18 +91,18 @@ yubico = { version = "0.9.1", features = ["online-tokio"], default-features = fa
dotenv = { version = "0.15.0", default-features = false }
# Lazy initialization
once_cell = "1.4.0"
once_cell = "1.4.1"
# Numerical libraries
num-traits = "0.2.12"
num-derive = "0.3.1"
num-derive = "0.3.2"
# Email libraries
lettre = { version = "0.10.0-alpha.1", features = ["smtp-transport", "builder", "serde", "native-tls", "hostname"], default-features = false }
native-tls = "0.2.4"
lettre = { version = "0.10.0-alpha.2", features = ["smtp-transport", "builder", "serde", "native-tls", "hostname"], default-features = false }
newline-converter = "0.1.0"
# Template library
handlebars = { version = "3.3.0", features = ["dir_source"] }
handlebars = { version = "3.4.0", features = ["dir_source"] }
# For favicon extraction from main website
soup = "0.5.0"
@ -118,7 +118,7 @@ percent-encoding = "2.1.0"
idna = "0.2.0"
# CLI argument parsing
structopt = "0.3.16"
structopt = "0.3.17"
# Logging panics to logfile instead stderr only
backtrace = "0.3.50"

View file

@ -49,7 +49,7 @@ use yubico::yubicoerror::YubicoError as YubiErr;
use lettre::address::AddressError as AddrErr;
use lettre::error::Error as LettreErr;
use lettre::message::mime::FromStrError as FromStrErr;
use lettre::transport::smtp::error::Error as SmtpErr;
use lettre::transport::smtp::Error as SmtpErr;
#[derive(Serialize)]
pub struct Empty {}

View file

@ -2,14 +2,13 @@ use std::{env, str::FromStr};
use chrono::{DateTime, Local};
use chrono_tz::Tz;
use native_tls::{Protocol, TlsConnector};
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use lettre::{
message::{header, Mailbox, Message, MultiPart, SinglePart},
transport::smtp::authentication::{Credentials, Mechanism as SmtpAuthMechanism},
transport::smtp::extension::ClientId,
Address, SmtpTransport, Tls, TlsParameters, Transport,
Address, SmtpTransport, Transport,
};
use crate::{
@ -20,28 +19,23 @@ use crate::{
};
fn mailer() -> SmtpTransport {
use std::time::Duration;
let host = CONFIG.smtp_host().unwrap();
let client_security = if CONFIG.smtp_ssl() {
let tls = TlsConnector::builder()
.min_protocol_version(Some(Protocol::Tlsv11))
.build()
.unwrap();
let params = TlsParameters::new(host.clone(), tls);
// Determine security
let smtp_client = if CONFIG.smtp_ssl() {
if CONFIG.smtp_explicit_tls() {
Tls::Wrapper(params)
SmtpTransport::relay(host.as_str())
} else {
Tls::Required(params)
SmtpTransport::starttls_relay(host.as_str())
}
} else {
Tls::None
Ok(SmtpTransport::builder_dangerous(host.as_str()))
};
use std::time::Duration;
let smtp_client = SmtpTransport::builder(host).port(CONFIG.smtp_port()).tls(client_security);
let smtp_client = smtp_client.unwrap()
.port(CONFIG.smtp_port())
.timeout(Some(Duration::from_secs(CONFIG.smtp_timeout())));
let smtp_client = match (CONFIG.smtp_username(), CONFIG.smtp_password()) {
(Some(user), Some(pass)) => smtp_client.credentials(Credentials::new(user, pass)),
@ -49,7 +43,7 @@ fn mailer() -> SmtpTransport {
};
let smtp_client = match CONFIG.helo_name() {
Some(helo_name) => smtp_client.hello_name(ClientId::new(helo_name)),
Some(helo_name) => smtp_client.hello_name(ClientId::Domain(helo_name)),
None => smtp_client,
};
@ -66,7 +60,7 @@ fn mailer() -> SmtpTransport {
_ => smtp_client,
};
smtp_client.timeout(Some(Duration::from_secs(CONFIG.smtp_timeout()))).build()
smtp_client.build()
}
fn get_text(template_name: &'static str, data: serde_json::Value) -> Result<(String, String, String), Error> {
@ -84,8 +78,9 @@ fn get_template(template_name: &str, data: &serde_json::Value) -> Result<(String
None => err!("Template doesn't contain subject"),
};
use newline_converter::unix2dos;
let body = match text_split.next() {
Some(s) => s.trim().to_string(),
Some(s) => unix2dos(s.trim()).to_string(),
None => err!("Template doesn't contain body"),
};
@ -303,25 +298,18 @@ fn send_email(address: &str, subject: &str, body_html: &str, body_text: &str) ->
let address = format!("{}@{}", address_split[1], domain_puny);
let data = MultiPart::mixed()
.multipart(
MultiPart::alternative()
.singlepart(
SinglePart::quoted_printable()
.header(header::ContentType("text/plain; charset=utf-8".parse()?))
.body(body_text),
)
.multipart(
MultiPart::related().singlepart(
SinglePart::quoted_printable()
.header(header::ContentType("text/html; charset=utf-8".parse()?))
.body(body_html),
)
// .singlepart(SinglePart::base64() -- Inline files would go here
),
)
// .singlepart(SinglePart::base64() -- Attachments would go here
;
let html = SinglePart::base64()
.header(header::ContentType("text/html; charset=utf-8".parse()?))
.body(body_html);
let text = SinglePart::base64()
.header(header::ContentType("text/plain; charset=utf-8".parse()?))
.body(body_text);
// The boundary generated by Lettre it self is mostly too large based on the RFC822, so we generate one our selfs.
use uuid::Uuid;
let boundary = format!("_Part_{}_", Uuid::new_v4().to_simple());
let alternative = MultiPart::alternative().boundary(boundary).singlepart(text).singlepart(html);
let email = Message::builder()
.to(Mailbox::new(None, Address::from_str(&address)?))
@ -330,7 +318,7 @@ fn send_email(address: &str, subject: &str, body_html: &str, body_text: &str) ->
Address::from_str(&CONFIG.smtp_from())?,
))
.subject(subject)
.multipart(data)?;
.multipart(alternative)?;
let _ = mailer().send(&email)?;
Ok(())