diff --git a/CHANGELOG.md b/CHANGELOG.md index 08bb764b..1eac5b08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If - Websupport - Yandex Cloud DNS - DNS updater: Log DNS record types and values. +- Sieve: Allow User Sieve scripts to access `orcpt`. ## Changed - Bump JMAP File Storage to [draft-ietf-jmap-filenode-14](https://datatracker.ietf.org/doc/html/draft-ietf-jmap-filenode-14). diff --git a/crates/email/src/message/delivery.rs b/crates/email/src/message/delivery.rs index 99b177cf..399d58c9 100644 --- a/crates/email/src/message/delivery.rs +++ b/crates/email/src/message/delivery.rs @@ -30,6 +30,7 @@ pub struct IngestMessage { #[derive(Debug)] pub struct IngestRecipient { pub address: String, + pub orcpt: Option, pub is_spam: bool, } diff --git a/crates/email/src/sieve/ingest.rs b/crates/email/src/sieve/ingest.rs index 7e772c14..4f363cba 100644 --- a/crates/email/src/sieve/ingest.rs +++ b/crates/email/src/sieve/ingest.rs @@ -129,6 +129,9 @@ impl SieveScriptIngest for Server { // Set envelope instance.set_envelope(Envelope::From, envelope_from); instance.set_envelope(Envelope::To, envelope_to.address.as_str()); + if let Some(orcpt) = &envelope_to.orcpt { + instance.set_envelope(Envelope::Orcpt, orcpt.as_str()); + } instance.set_spam_status(if envelope_to.is_spam { SpamStatus::Spam } else { diff --git a/crates/http/src/form/mod.rs b/crates/http/src/form/mod.rs index 5985a283..52475460 100644 --- a/crates/http/src/form/mod.rs +++ b/crates/http/src/form/mod.rs @@ -183,6 +183,7 @@ impl FormHandler for Server { .iter() .map(|address| IngestRecipient { address: address.clone(), + orcpt: None, is_spam: false, }) .collect(), diff --git a/crates/smtp/src/outbound/local.rs b/crates/smtp/src/outbound/local.rs index 598cf160..3ae354e4 100644 --- a/crates/smtp/src/outbound/local.rs +++ b/crates/smtp/src/outbound/local.rs @@ -33,6 +33,7 @@ impl MessageWrapper { let rcpt_addr = rcpt.address(); recipients.push(IngestRecipient { address: rcpt_addr.to_lowercase(), + orcpt: rcpt.orcpt.as_ref().map(|orcpt| orcpt.to_string()), is_spam: rcpt.flags & RCPT_SPAM_PAYLOAD != 0, }); pending_recipients.push((rcpt_idx, rcpt_addr));