mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 15:26:30 +03:00
feat: Remove limit on number of email recipients for chatmail clients (#5598)
This commit is contained in:
@@ -2995,11 +2995,7 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
|
|||||||
|
|
||||||
msg.subject.clone_from(&rendered_msg.subject);
|
msg.subject.clone_from(&rendered_msg.subject);
|
||||||
msg.update_subject(context).await?;
|
msg.update_subject(context).await?;
|
||||||
let chunk_size = context
|
let chunk_size = context.get_max_smtp_rcpt_to().await?;
|
||||||
.get_configured_provider()
|
|
||||||
.await?
|
|
||||||
.and_then(|provider| provider.opt.max_smtp_rcpt_to)
|
|
||||||
.map_or(constants::DEFAULT_MAX_SMTP_RCPT_TO, usize::from);
|
|
||||||
let trans_fn = |t: &mut rusqlite::Transaction| {
|
let trans_fn = |t: &mut rusqlite::Transaction| {
|
||||||
let mut row_ids = Vec::<i64>::new();
|
let mut row_ids = Vec::<i64>::new();
|
||||||
for recipients_chunk in recipients.chunks(chunk_size) {
|
for recipients_chunk in recipients.chunks(chunk_size) {
|
||||||
|
|||||||
@@ -498,6 +498,23 @@ impl Context {
|
|||||||
self.get_config_bool(Config::IsChatmail).await
|
self.get_config_bool(Config::IsChatmail).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns maximum number of recipients the provider allows to send a single email to.
|
||||||
|
pub(crate) async fn get_max_smtp_rcpt_to(&self) -> Result<usize> {
|
||||||
|
let is_chatmail = self.is_chatmail().await?;
|
||||||
|
let val = self
|
||||||
|
.get_configured_provider()
|
||||||
|
.await?
|
||||||
|
.and_then(|provider| provider.opt.max_smtp_rcpt_to)
|
||||||
|
.map_or_else(
|
||||||
|
|| match is_chatmail {
|
||||||
|
true => usize::MAX,
|
||||||
|
false => constants::DEFAULT_MAX_SMTP_RCPT_TO,
|
||||||
|
},
|
||||||
|
usize::from,
|
||||||
|
);
|
||||||
|
Ok(val)
|
||||||
|
}
|
||||||
|
|
||||||
/// Does a background fetch
|
/// Does a background fetch
|
||||||
/// pauses the scheduler and does one imap fetch, then unpauses and returns
|
/// pauses the scheduler and does one imap fetch, then unpauses and returns
|
||||||
pub async fn background_fetch(&self) -> Result<()> {
|
pub async fn background_fetch(&self) -> Result<()> {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use deltachat_contact_tools::EmailAddress;
|
|||||||
use rusqlite::OptionalExtension;
|
use rusqlite::OptionalExtension;
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::constants::{self, ShowEmails};
|
use crate::constants::ShowEmails;
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::imap;
|
use crate::imap;
|
||||||
use crate::message::MsgId;
|
use crate::message::MsgId;
|
||||||
@@ -839,11 +839,7 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid);
|
|||||||
|
|
||||||
if dbversion < 108 {
|
if dbversion < 108 {
|
||||||
let version = 108;
|
let version = 108;
|
||||||
let chunk_size = context
|
let chunk_size = context.get_max_smtp_rcpt_to().await?;
|
||||||
.get_configured_provider()
|
|
||||||
.await?
|
|
||||||
.and_then(|provider| provider.opt.max_smtp_rcpt_to)
|
|
||||||
.map_or(constants::DEFAULT_MAX_SMTP_RCPT_TO, usize::from);
|
|
||||||
sql.transaction(move |trans| {
|
sql.transaction(move |trans| {
|
||||||
Sql::set_db_version_trans(trans, version)?;
|
Sql::set_db_version_trans(trans, version)?;
|
||||||
let id_max =
|
let id_max =
|
||||||
|
|||||||
Reference in New Issue
Block a user