diff --git a/src/config.rs b/src/config.rs index c124f08b0b..ad5492939f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -475,6 +475,15 @@ impl Context { || self.get_config_bool(Config::OnlyFetchMvbox).await?) } + /// Returns true if sentbox ("Sent" folder) should be watched. + pub(crate) async fn should_watch_sentbox(&self) -> Result { + Ok(self.get_config_bool(Config::SentboxWatch).await? + && self + .get_config(Config::ConfiguredSentboxFolder) + .await? + .is_some()) + } + /// Gets configured "delete_server_after" value. /// /// `None` means never delete the message, `Some(0)` means delete diff --git a/src/scheduler.rs b/src/scheduler.rs index 948ac152bf..651d50b867 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -830,10 +830,7 @@ impl Scheduler { for (meaning, should_watch) in [ (FolderMeaning::Mvbox, ctx.should_watch_mvbox().await), - ( - FolderMeaning::Sent, - ctx.get_config_bool(Config::SentboxWatch).await, - ), + (FolderMeaning::Sent, ctx.should_watch_sentbox().await), ] { if should_watch? { let (conn_state, handlers) = ImapConnectionState::new(ctx).await?;