fix message send save copy

This commit is contained in:
Clément DOUIN 2023-12-20 14:55:09 +01:00
parent 3f2f691e85
commit cd7cecca6e
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
5 changed files with 8 additions and 22 deletions

4
Cargo.lock generated
View file

@ -1216,9 +1216,9 @@ dependencies = [
[[package]]
name = "email-lib"
version = "0.18.1"
version = "0.18.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da9ffadf48ca05751f693d3a81a224b61b740699ffa2dd013a0f0ffc4529a01"
checksum = "f1f878a2c5b35497a8c0560053a30e9acccdb3ee91f399f742517c69c7616172"
dependencies = [
"advisory-lock",
"anyhow",

View file

@ -50,7 +50,7 @@ clap_mangen = "0.2"
console = "0.15.2"
dialoguer = "0.10.2"
dirs = "4.0"
email-lib = { version = "=0.18.1", default-features = false }
email-lib = { version = "=0.18.2", default-features = false }
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"

View file

@ -54,6 +54,9 @@ envelope.watch.received.notify.body = "{subject}"
# Override the backend used for sending messages.
message.send.backend = "smtp"
# Save a copy of sent messages to the sent folder.
message.send.save-copy = true
# IMAP config
imap.host = "localhost"
imap.port = 3143

View file

@ -1,6 +1,5 @@
use anyhow::Result;
use clap::Parser;
use email::{flag::Flag, folder::SENT};
use log::info;
use std::io::{self, BufRead, IsTerminal};
@ -49,13 +48,6 @@ impl MessageSendCommand {
backend.send_raw_message(msg.as_bytes()).await?;
if account_config.should_save_copy_sent_message() {
backend
.add_raw_message_with_flag(SENT, msg.as_bytes(), Flag::Seen)
.await?;
printer.print("Message successfully sent and saved to the Sent folder!")
} else {
printer.print("Message successfully sent!")
}
printer.print("Message successfully sent!")
}
}

View file

@ -1,6 +1,5 @@
use anyhow::Result;
use clap::Parser;
use email::{flag::Flag, folder::SENT};
use log::info;
use mml::MmlCompilerBuilder;
use std::io::{self, BufRead, IsTerminal};
@ -60,14 +59,6 @@ impl TemplateSendCommand {
backend.send_raw_message(&msg).await?;
if account_config.should_save_copy_sent_message() {
backend
.add_raw_message_with_flag(SENT, &msg, Flag::Seen)
.await?;
printer.print("Template successfully sent and saved to the Sent folder!")
} else {
printer.print("Template successfully sent!")
}
printer.print("Template successfully sent!")
}
}