mirror of
https://github.com/chatmail/core.git
synced 2026-09-22 13:01:21 +03:00
feat: queue messages for SMTP before encryption
Headers like From and Autocrypt are now added late, right before sending the message over SMTP. This way we advertise the latest list of transports and use the correct From address in the encrypted part even for messages queued while being offline. BCC-self recipients are also added late. For unencrypted messages we only want to send a copy to the sending address, but we don't know the sending address when queueing the message. Adding bcc-self recipients when dequeuing the message also makes it possible to send copies to updated list of relays.
This commit is contained in:
@@ -2642,6 +2642,37 @@ UPDATE msgs SET state=24 WHERE state=18; -- Change OutPreparing to OutFailed.
|
||||
.await?;
|
||||
}
|
||||
|
||||
inc_and_check(&mut migration_version, 166)?;
|
||||
if dbversion < migration_version {
|
||||
sql.execute_migration(
|
||||
"
|
||||
UPDATE msgs
|
||||
SET state=24, -- OutFailed
|
||||
error='Message sending canceled by upgrade'
|
||||
WHERE state=20 AND id IN (SELECT msg_id FROM smtp); -- OutPending
|
||||
DELETE FROM smtp;
|
||||
CREATE TABLE smtp2 (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
display_name TEXT NOT NULL,
|
||||
rfc724_mid TEXT NOT NULL,
|
||||
mime BLOB NOT NULL,
|
||||
should_attach_pubkey INTEGER NOT NULL,
|
||||
should_compress INTEGER NOT NULL,
|
||||
should_sign INTEGER NOT NULL,
|
||||
msg_id INTEGER NOT NULL,
|
||||
recipients TEXT NOT NULL,
|
||||
sent_to TEXT NOT NULL DEFAULT '',
|
||||
bcc_self INTEGER NOT NULL,
|
||||
is_encrypted INTEGER NOT NULL,
|
||||
shared_secret TEXT NOT NULL DEFAULT '',
|
||||
encryption_fingerprints TEXT NOT NULL DEFAULT '',
|
||||
retries INTEGER NOT NULL DEFAULT 0
|
||||
) STRICT;",
|
||||
migration_version,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
let new_version = sql
|
||||
.get_raw_config_int(VERSION_CFG)
|
||||
.await?
|
||||
|
||||
Reference in New Issue
Block a user