Sieve: Allow User Sieve scripts to access orcpt

This commit is contained in:
Maurus Decimus
2026-05-19 17:40:45 +02:00
parent e54221dde6
commit f048e0f0bb
5 changed files with 7 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ pub struct IngestMessage {
#[derive(Debug)]
pub struct IngestRecipient {
pub address: String,
pub orcpt: Option<String>,
pub is_spam: bool,
}

View File

@@ -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 {

View File

@@ -183,6 +183,7 @@ impl FormHandler for Server {
.iter()
.map(|address| IngestRecipient {
address: address.clone(),
orcpt: None,
is_spam: false,
})
.collect(),

View File

@@ -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));