diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ab0ff..2380c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,21 +30,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- Refactored IMAP and SMTP auth config API +- Improved error messages when missing cargo features. For example, if a TOML configuration uses the IMAP backend without the `imap` cargo features, the error `missing "imap" feature` is displayed. [#20](https://github.com/pimalaya/core/issues/20) +- Normalized enum-based configurations, using the [internally tagged representation](https://serde.rs/enum-representations.html#internally-tagged) `type =`. It should reduce issues due to misconfiguration, and improve othe error messages. Yet it is not perfect, see [#802](https://github.com/toml-rs/toml/issues/802): - The IMAP and SMTP auth config option is now explicit, in order to improve error messages: + - `imap.*`, `maildir.*` and `notmuch.*` moved to `backend.*`: - ```toml - # before - imap.password.cmd = "pass show example" - smtp.oauth2.method = "xoauth2" + ```toml + # before + imap.host = "localhost" + imap.port = 143 - # after - imap.auth.type = "password" - imap.auth.cmd = "pass show example" - smtp.auth.type = "oauth2" - smtp.auth.method = "xoauth2" - ``` + # after + backend.type = "imap" + backend.host = "localhost" + backend.port = 143 + ``` + + - `smtp.*` and `sendmail.*` moved to `message.send.backend.*`: + + ```toml + # before + smtp.host = "localhost" + smtp.port = 25 + + # after + message.send.backend.type = "smtp" + message.send.backend.host = "localhost" + message.send.backend.port = 25 + ``` + + - `pgp.backend` renamed `pgp.type`: + + ```toml + # before + pgp.backend = "commands" + pgp.encrypt-cmd = "gpg --encrypt --quiet --armor " + + # after + pgp.type = "commands" + pgp.encrypt-cmd = "gpg --encrypt --quiet --armor " + ``` + + - `{imap,smtp}.auth` moved as well: + + ```toml + # before + imap.password.cmd = "pass show example" + smtp.oauth2.method = "xoauth2" + + # after + backend.auth.type = "password" + backend.auth.cmd = "pass show example" + message.send.backend.auth.type = "oauth2" + message.send.backend.auth.method = "xoauth2" + ``` ## [1.0.0-beta.4] - 2024-04-16 @@ -849,18 +888,3 @@ Few major concepts changed: [0.2.1]: https://github.com/soywod/himalaya/compare/v0.2.0...v0.2.1 [0.2.0]: https://github.com/soywod/himalaya/compare/v0.1.0...v0.2.0 [0.1.0]: https://github.com/soywod/himalaya/releases/tag/v0.1.0 - -[#39]: https://todo.sr.ht/~soywod/pimalaya/39 -[#41]: https://todo.sr.ht/~soywod/pimalaya/41 -[#43]: https://todo.sr.ht/~soywod/pimalaya/43 -[#54]: https://todo.sr.ht/~soywod/pimalaya/54 -[#58]: https://todo.sr.ht/~soywod/pimalaya/58 -[#59]: https://todo.sr.ht/~soywod/pimalaya/59 -[#60]: https://todo.sr.ht/~soywod/pimalaya/60 -[#95]: https://todo.sr.ht/~soywod/pimalaya/95 -[#172]: https://todo.sr.ht/~soywod/pimalaya/172 -[#173]: https://todo.sr.ht/~soywod/pimalaya/173 -[#184]: https://todo.sr.ht/~soywod/pimalaya/184 -[#188]: https://todo.sr.ht/~soywod/pimalaya/188 -[#194]: https://todo.sr.ht/~soywod/pimalaya/194 -[#195]: https://todo.sr.ht/~soywod/pimalaya/195 diff --git a/Cargo.lock b/Cargo.lock index 985a068..410b589 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" dependencies = [ "anstyle", "anstyle-parse", @@ -114,36 +114,36 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -679,9 +679,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "combine" @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "email-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "async-trait", "chrono", @@ -1251,9 +1251,6 @@ name = "email_address" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e079f19b08ca6239f47f8ba8509c11cf3ea30095831f7fed61441475edd8c449" -dependencies = [ - "serde", -] [[package]] name = "encoding_rs" @@ -1753,24 +1750,15 @@ name = "himalaya" version = "1.0.0" dependencies = [ "ariadne", - "async-trait", "clap", "clap_complete", "clap_mangen", "color-eyre", - "comfy-table", - "crossterm 0.27.0", - "dirs 4.0.0", "email-lib", - "email_address", "mail-builder", - "md5", "mml-lib", - "oauth-lib", "once_cell", - "petgraph", "pimalaya-tui", - "process-lib", "secret-lib", "serde", "serde_json", @@ -1837,7 +1825,7 @@ dependencies = [ [[package]] name = "http-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "thiserror", "tokio", @@ -2105,7 +2093,7 @@ dependencies = [ [[package]] name = "keyring" version = "3.5.0" -source = "git+https://github.com/soywod/keyring-rs.git?branch=secret-service-with-keyutils#16236b85f92733550cce0a5e06fe4e63cf835b71" +source = "git+https://github.com/soywod/keyring-rs.git?branch=secret-service-with-keyutils#f59afd50e4b9be4e333e6c050ac8f97f51fe632d" dependencies = [ "byteorder", "dbus-secret-service", @@ -2121,7 +2109,7 @@ dependencies = [ [[package]] name = "keyring-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "keyring", "once_cell", @@ -2401,7 +2389,7 @@ dependencies = [ [[package]] name = "mml-lib" version = "1.1.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "async-recursion", "chumsky", @@ -2600,7 +2588,7 @@ dependencies = [ [[package]] name = "oauth-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "http-lib", "oauth2", @@ -2873,7 +2861,7 @@ dependencies = [ [[package]] name = "pgp-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "async-recursion", "futures", @@ -2891,7 +2879,7 @@ dependencies = [ [[package]] name = "pimalaya-tui" version = "1.0.0" -source = "git+https://github.com/pimalaya/tui#1f83c115d7aa3d12ff278a7b4bc10d4b7157286f" +source = "git+https://github.com/pimalaya/tui#d3664c02dce63fe0f91b7e47a49e68bbe86f5bfc" dependencies = [ "async-trait", "clap", @@ -3050,7 +3038,7 @@ dependencies = [ [[package]] name = "process-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "serde", "thiserror", @@ -3154,9 +3142,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -3499,7 +3487,7 @@ dependencies = [ [[package]] name = "secret-lib" version = "1.0.0" -source = "git+https://github.com/pimalaya/core#3d94ec45b2cbdda4f1bd75d83f4adc9837d5f3bd" +source = "git+https://github.com/pimalaya/core#79a960a684274537788d1193fe3db5bcf66cfb7e" dependencies = [ "keyring-lib", "process-lib", diff --git a/Cargo.toml b/Cargo.toml index b36fe4b..b09195b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,8 @@ smtp = ["email-lib/smtp", "pimalaya-tui/smtp"] sendmail = ["email-lib/sendmail", "pimalaya-tui/sendmail"] keyring = ["email-lib/keyring", "pimalaya-tui/keyring", "secret-lib/keyring"] -oauth2 = ["dep:oauth-lib", "email-lib/oauth2", "pimalaya-tui/oauth2", "keyring"] -wizard = ["dep:email_address", "email-lib/autoconfig", "pimalaya-tui/wizard"] +oauth2 = ["email-lib/oauth2", "pimalaya-tui/oauth2", "keyring"] +wizard = ["email-lib/autoconfig", "pimalaya-tui/wizard"] pgp = [] pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pimalaya-tui/pgp-commands", "pgp"] @@ -47,24 +47,15 @@ pgp-native = ["email-lib/pgp-native", "mml-lib/pgp-native", "pimalaya-tui/pgp-na [dependencies] ariadne = "0.2" -async-trait = "0.1" clap = { version = "4.4", features = ["derive", "env", "wrap_help"] } clap_complete = "4.4" clap_mangen = "0.2" color-eyre = "0.6" -comfy-table = "7.1" -crossterm = { version = "0.27", features = ["serde"] } -dirs = "4" email-lib = { version = "1", default-features = false, features = ["tokio-rustls", "derive", "thread"] } -email_address = { version = "0.2", optional = true } mail-builder = "0.3" -md5 = "0.7" mml-lib = { version = "1", default-features = false, features = ["derive"] } -oauth-lib = { version = "1", optional = true } once_cell = "1.16" -petgraph = "0.6" pimalaya-tui = { version = "1", default-features = false, features = ["email", "path", "cli", "himalaya", "tracing", "sled"] } -process-lib = { version = "1", features = ["derive"] } secret-lib = { version = "1", default-features = false, features = ["tokio", "rustls", "command", "derive"] } serde = { version = "1", features = ["derive"] } serde_json = "1" @@ -83,8 +74,11 @@ imap-client = { git = "https://github.com/pimalaya/imap-client" } # Pimalaya core email-lib = { git = "https://github.com/pimalaya/core" } +http-lib = { git = "https://github.com/pimalaya/core" } +keyring-lib = { git = "https://github.com/pimalaya/core" } mml-lib = { git = "https://github.com/pimalaya/core" } oauth-lib = { git = "https://github.com/pimalaya/core" } +pgp-lib = { git = "https://github.com/pimalaya/core" } process-lib = { git = "https://github.com/pimalaya/core" } secret-lib = { git = "https://github.com/pimalaya/core" } diff --git a/README.md b/README.md index f68c967..51ed3e4 100644 --- a/README.md +++ b/README.md @@ -621,12 +621,13 @@ You can also manually edit your own configuration, from scratch: ## Sponsoring -[![nlnet](https://nlnet.nl/logo/banner-160x60.png)](https://nlnet.nl/project/Himalaya/index.html) +[![nlnet](https://nlnet.nl/logo/banner-160x60.png)](https://nlnet.nl/) -Special thanks to the [NLnet foundation](https://nlnet.nl/project/Himalaya/index.html) and the [European Commission](https://www.ngi.eu/) that helped the project to receive financial support from: +Special thanks to the [NLnet foundation](https://nlnet.nl/) and the [European Commission](https://www.ngi.eu/) that helped the project to receive financial support from various programs: -- [NGI Assure](https://nlnet.nl/assure/) in 2022 -- [NGI Zero Entrust](https://nlnet.nl/entrust/) in 2023 +- [NGI Assure](https://nlnet.nl/project/Himalaya/) in 2022 +- [NGI Zero Entrust](https://nlnet.nl/project/Pimalaya/) in 2023 +- [NGI Zero Core](https://nlnet.nl/project/Pimalaya-PIM/) in 2024 *(still ongoing)* If you appreciate the project, feel free to donate using one of the following providers: diff --git a/config.sample.toml b/config.sample.toml index a24293f..4dc72c0 100644 --- a/config.sample.toml +++ b/config.sample.toml @@ -288,13 +288,80 @@ template.forward.signature-style = "inlined" template.forward.quote-headline = "-------- Forwarded Message --------\n" ######################################## -#### PGP configuration ################# +#### GPG-based PGP configuration ####### ######################################## -# TODO -#pgp.backend = "commands" -#pgp.backend = "gpg" -#pgp.backend = "native" +# Enables PGP using GPG bindings. It requires the GPG lib to be +# installed on the system, and the `pgp-gpg` cargo feature on. +# +#pgp.type = "gpg" + +######################################## +#### Command-based PGP configuration ### +######################################## + +# Enables PGP using shell commands. A PGP client needs to be installed +# on the system, like gpg. It also requires the `pgp-commands` cargo +# feature. +# +#pgp.type = "commands" + +# Defines the encrypt command. The special placeholder `` +# represents the list of recipients, formatted by +# `pgp.encrypt-recipient-fmt`. +# +#pgp.encrypt-cmd = "gpg --encrypt --quiet --armor " + +# Formats recipients for `pgp.encrypt-cmd`. The special placeholder +# `` is replaced by an actual recipient at runtime. +# +#pgp.encrypt-recipient-fmt = "--recipient " + +# Defines the separator used between formatted recipients +# `pgp.encrypt-recipient-fmt`. +# +#pgp.encrypt-recipients-sep = " " + +# Defines the decrypt command. +# +#pgp.decrypt-cmd = "gpg --decrypt --quiet" + +# Defines the sign command. +# +#pgp.sign-cmd = "gpg --sign --quiet --armor" + +# Defines the verify command. +# +#pgp.verify-cmd = "gpg --verify --quiet" + +######################################## +#### Native PGP configuration ########## +######################################## + +# Enables the native Rust implementation of PGP. It requires the +# `pgp-native` cargo feature. +# +#pgp.type = "native" + +# Defines where to find the PGP secret key. +# +#pgp.secret-key.path = "/path/to/secret.key" +#pgp.secret-key.keyring = "my-pgp-secret-key" + +# Defines how to retrieve the PGP secret key passphrase. +# +#pgp.secret-key-passphrase.raw = "p@assw0rd" +#pgp.secret-key-passphrase.keyring = "my-pgp-passphrase" +#pgp.secret-key-passphrase.cmd = "pass show pgp-passphrase" + +# Enables the Web Key Discovery protocol to discover recipients' +# public key based on their email address. +# +#pgp.wkd = true + +# Enables public key servers discovery. +# +#pgp.key-servers = ["hkps://keys.openpgp.org", "hkps://keys.mailvelope.com"] ######################################## #### IMAP configuration ################ @@ -302,54 +369,54 @@ template.forward.quote-headline = "-------- Forwarded Message --------\n" # Defines the IMAP backend as the default one for all features. # -backend = "imap" +backend.type = "imap" # IMAP server host name. # -imap.host = "localhost" +backend.host = "localhost" # IMAP server port. # -#imap.port = 143 -imap.port = 993 +#backend.port = 143 +backend.port = 993 # IMAP server encryption. # -#imap.encryption = "none" # or false -#imap.encryption = "start-tls" -imap.encryption = "tls" # or true +#backend.encryption = "none" # or false +#backend.encryption = "start-tls" +backend.encryption = "tls" # or true # IMAP server login. # -imap.login = "example@localhost" +backend.login = "example@localhost" # IMAP server password authentication configuration. # -imap.auth.type = "password" +backend.auth.type = "password" # # Password can be inlined (not recommended). # -#imap.auth.raw = "p@assw0rd" +#backend.auth.raw = "p@assw0rd" # # Password can be stored inside your system global keyring (requires # the keyring cargo feature). You must run at least once `himalaya # account configure` to set up the password. # -#imap.auth.keyring = "example-imap" +#backend.auth.keyring = "example-imap" # # Password can be retrieved from a shell command. # -imap.auth.cmd = "pass show example-imap" +backend.auth.cmd = "pass show example-imap" # IMAP server OAuth 2.0 authorization configuration. # -#imap.auth.type = "oauth2" +#backend.auth.type = "oauth2" # # Client identifier issued to the client during the registration # process described in RFC6749. # See . # -#imap.auth.client-id = "client-id" +#backend.auth.client-id = "client-id" # # Client password issued to the client during the registration process # described in RFC6749. @@ -357,23 +424,23 @@ imap.auth.cmd = "pass show example-imap" # Defaults to keyring "-imap-client-secret". # See . # -#imap.auth.client-secret.raw = "" -#imap.auth.client-secret.keyring = "example-imap-client-secret" -#imap.auth.client-secret.cmd = "pass show example-imap-client-secret" +#backend.auth.client-secret.raw = "" +#backend.auth.client-secret.keyring = "example-imap-client-secret" +#backend.auth.client-secret.cmd = "pass show example-imap-client-secret" # # Method for presenting an OAuth 2.0 bearer token to a service for # authentication. # -#imap.auth.method = "oauthbearer" -#imap.auth.method = "xoauth2" +#backend.auth.method = "oauthbearer" +#backend.auth.method = "xoauth2" # # URL of the authorization server's authorization endpoint. # -#imap.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" +#backend.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" # # URL of the authorization server's token endpoint. # -#imap.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" +#backend.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" # # Access token returned by the token endpoint and used to access # protected resources. It is recommended to use the keyring variant, @@ -381,9 +448,9 @@ imap.auth.cmd = "pass show example-imap" # # Defaults to keyring "-imap-access-token". # -#imap.auth.access-token.raw = "" -#imap.auth.access-token.keyring = "example-imap-access-token" -#imap.auth.access-token.cmd = "pass show example-imap-access-token" +#backend.auth.access-token.raw = "" +#backend.auth.access-token.keyring = "example-imap-access-token" +#backend.auth.access-token.cmd = "pass show example-imap-access-token" # # Refresh token used to obtain a new access token (if supported by the # authorization server). It is recommended to use the keyring variant, @@ -391,30 +458,35 @@ imap.auth.cmd = "pass show example-imap" # # Defaults to keyring "-imap-refresh-token". # -#imap.auth.refresh-token.raw = "" -#imap.auth.refresh-token.keyring = "example-imap-refresh-token" -#imap.auth.refresh-token.cmd = "pass show example-imap-refresh-token" +#backend.auth.refresh-token.raw = "" +#backend.auth.refresh-token.keyring = "example-imap-refresh-token" +#backend.auth.refresh-token.cmd = "pass show example-imap-refresh-token" # # Enable the protection, as defined in RFC7636. # # See . # -#imap.auth.pkce = true +#backend.auth.pkce = true # # Access token scope(s), as defined by the authorization server. # -#imap.auth.scope = "unique scope" -#imap.auth.scopes = ["multiple", "scopes"] +#backend.auth.scope = "unique scope" +#backend.auth.scopes = ["multiple", "scopes"] +# +# URL scheme of the redirect server. +# Defaults to http. +# +#backend.auth.redirect-scheme = "http" # # Host name of the redirect server. # Defaults to localhost. # -#imap.auth.redirect-host = "localhost" +#backend.auth.redirect-host = "localhost" # # Port of the redirect server. # Defaults to the first available one. # -#imap.auth.redirect-port = 9999 +#backend.auth.redirect-port = 9999 ######################################## #### Maildir configuration ############# @@ -422,18 +494,18 @@ imap.auth.cmd = "pass show example-imap" # Defines the Maildir backend as the default one for all features. # -#backend = "maildir" +#backend.type = "maildir" # The Maildir root directory. The path should point to the root level # of the Maildir directory. # -#maildir.root-dir = "~/.Mail/example" +#backend.root-dir = "~/.Mail/example" # Does the Maildir folder follows the Maildir++ standard? # # See . # -#maildir.maildirpp = false +#backend.maildirpp = false ######################################## #### Notmuch configuration ############# @@ -441,25 +513,25 @@ imap.auth.cmd = "pass show example-imap" # Defines the Notmuch backend as the default one for all features. # -#backend = "notmuch" +#backend.type = "notmuch" # The path to the Notmuch database. The path should point to the root # directory containing the Notmuch database (usually the root Maildir # directory). # -#notmuch.db-path = "~/.Mail/example" +#backend.db-path = "~/.Mail/example" # Overrides the default path to the Maildir folder. # -#notmuch.maildir-path = "~/.Mail/example" +#backend.maildir-path = "~/.Mail/example" # Overrides the default Notmuch configuration file path. # -#notmuch.config-path = "~/.notmuchrc" +#backend.config-path = "~/.notmuchrc" # Override the default Notmuch profile name. # -#notmuch.profile = "example" +#backend.profile = "example" ######################################## #### SMTP configuration ################ @@ -467,55 +539,55 @@ imap.auth.cmd = "pass show example-imap" # Defines the SMTP backend for the message sending feature. # -message.send.backend = "smtp" +message.send.backend.type = "smtp" # SMTP server host name. # -smtp.host = "localhost" +message.send.backend.host = "localhost" # SMTP server port. # -#smtp.port = 25 -#smtp.port = 465 -smtp.port = 587 +#message.send.backend.port = 25 +#message.send.backend.port = 465 +message.send.backend.port = 587 # SMTP server encryption. # -#smtp.encryption = "none" # or false -#smtp.encryption = "start-tls" -smtp.encryption = "tls" # or true +#message.send.backend.encryption = "none" # or false +#message.send.backend.encryption = "start-tls" +message.send.backend.encryption = "tls" # or true # SMTP server login. # -smtp.login = "example@localhost" +message.send.backend.login = "example@localhost" # SMTP server password authentication configuration. # -smtp.auth.type = "password" +message.send.backend.auth.type = "password" # # Password can be inlined (not recommended). # -#smtp.auth.raw = "p@assw0rd" +#message.send.backend.auth.raw = "p@assw0rd" # # Password can be stored inside your system global keyring (requires # the keyring cargo feature). You must run at least once `himalaya # account configure` to set up the password. # -#smtp.auth.keyring = "example-smtp" +#message.send.backend.auth.keyring = "example-smtp" # # Password can be retrieved from a shell command. # -smtp.auth.cmd = "pass show example-smtp" +message.send.backend.auth.cmd = "pass show example-smtp" # SMTP server OAuth 2.0 authorization configuration. # -#smtp.auth.type = "oauth2" +#message.send.backend.auth.type = "oauth2" # # Client identifier issued to the client during the registration # process described in RFC6749. # See . # -#smtp.auth.client-id = "client-id" +#message.send.backend.auth.client-id = "client-id" # # Client password issued to the client during the registration process # described in RFC6749. @@ -523,23 +595,23 @@ smtp.auth.cmd = "pass show example-smtp" # Defaults to keyring "-smtp-client-secret". # See . # -#smtp.auth.client-secret.raw = "" -#smtp.auth.client-secret.keyring = "example-smtp-client-secret" -#smtp.auth.client-secret.cmd = "pass show example-smtp-client-secret" +#message.send.backend.auth.client-secret.raw = "" +#message.send.backend.auth.client-secret.keyring = "example-smtp-client-secret" +#message.send.backend.auth.client-secret.cmd = "pass show example-smtp-client-secret" # # Method for presenting an OAuth 2.0 bearer token to a service for # authentication. # -#smtp.auth.method = "oauthbearer" -#smtp.auth.method = "xoauth2" +#message.send.backend.auth.method = "oauthbearer" +#message.send.backend.auth.method = "xoauth2" # # URL of the authorization server's authorization endpoint. # -#smtp.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" +#message.send.backend.auth.auth-url = "https://accounts.google.com/o/oauth2/v2/auth" # # URL of the authorization server's token endpoint. # -#smtp.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" +#message.send.backend.auth.token-url = "https://www.googleapis.com/oauth2/v3/token" # # Access token returned by the token endpoint and used to access # protected resources. It is recommended to use the keyring variant, @@ -547,9 +619,9 @@ smtp.auth.cmd = "pass show example-smtp" # # Defaults to keyring "-smtp-access-token". # -#smtp.auth.access-token.raw = "" -#smtp.auth.access-token.keyring = "example-smtp-access-token" -#smtp.auth.access-token.cmd = "pass show example-smtp-access-token" +#message.send.backend.auth.access-token.raw = "" +#message.send.backend.auth.access-token.keyring = "example-smtp-access-token" +#message.send.backend.auth.access-token.cmd = "pass show example-smtp-access-token" # # Refresh token used to obtain a new access token (if supported by the # authorization server). It is recommended to use the keyring variant, @@ -557,30 +629,35 @@ smtp.auth.cmd = "pass show example-smtp" # # Defaults to keyring "-smtp-refresh-token". # -#smtp.auth.refresh-token.raw = "" -#smtp.auth.refresh-token.keyring = "example-smtp-refresh-token" -#smtp.auth.refresh-token.cmd = "pass show example-smtp-refresh-token" +#message.send.backend.auth.refresh-token.raw = "" +#message.send.backend.auth.refresh-token.keyring = "example-smtp-refresh-token" +#message.send.backend.auth.refresh-token.cmd = "pass show example-smtp-refresh-token" # # Enable the protection, as defined in RFC7636. # # See . # -#smtp.auth.pkce = true +#message.send.backend.auth.pkce = true # # Access token scope(s), as defined by the authorization server. # -#smtp.auth.scope = "unique scope" -#smtp.auth.scopes = ["multiple", "scopes"] +#message.send.backend.auth.scope = "unique scope" +#message.send.backend.auth.scopes = ["multiple", "scopes"] +# +# URL scheme of the redirect server. +# Defaults to http. +# +#message.send.backend.auth.redirect-scheme = "http" # # Host name of the redirect server. # Defaults to localhost. # -#smtp.auth.redirect-host = "localhost" +#message.send.backend.auth.redirect-host = "localhost" # # Port of the redirect server. # Defaults to the first available one. # -#smtp.auth.redirect-port = 9999 +#message.send.backend.auth.redirect-port = 9999 ######################################## #### Sendmail configuration ############ @@ -588,8 +665,8 @@ smtp.auth.cmd = "pass show example-smtp" # Defines the Sendmail backend for the message sending feature. # -#message.send.backend = "sendmail" +#message.send.backend.type = "sendmail" # Customizes the sendmail shell command. # -#sendmail.cmd = "/usr/bin/sendmail" +#message.send.backend.cmd = "/usr/bin/sendmail" diff --git a/src/account/command/configure.rs b/src/account/command/configure.rs index 12aba23..dbeb9c2 100644 --- a/src/account/command/configure.rs +++ b/src/account/command/configure.rs @@ -57,7 +57,7 @@ impl AccountConfigureCommand { #[cfg(feature = "smtp")] { let reset = match toml_account_config.smtp_auth_config() { - Some(SmtpAuthConfig::Passwd(config)) => config.reset().await, + Some(SmtpAuthConfig::Password(config)) => config.reset().await, #[cfg(feature = "oauth2")] Some(SmtpAuthConfig::OAuth2(config)) => config.reset().await, _ => Ok(()), @@ -93,7 +93,7 @@ impl AccountConfigureCommand { #[cfg(feature = "smtp")] match toml_account_config.smtp_auth_config() { - Some(SmtpAuthConfig::Passwd(config)) => { + Some(SmtpAuthConfig::Password(config)) => { config .configure(|| Ok(prompt::password("SMTP password")?)) .await diff --git a/src/email/envelope/command/list.rs b/src/email/envelope/command/list.rs index d61f731..d8b5739 100644 --- a/src/email/envelope/command/list.rs +++ b/src/email/envelope/command/list.rs @@ -161,6 +161,7 @@ impl ListEnvelopesCommand { .with_list_envelopes(BackendFeatureSource::Context) }, ) + .without_sending_backend() .build() .await?;