Skip to main content

ReceiveContext

Struct ReceiveContext 

Source
#[non_exhaustive]
pub struct ReceiveContext {
Show 13 fields pub client_ip: IpAddr, pub ehlo_domain: String, pub sender: String, pub recipient: String, pub message: Vec<u8>, pub hostname: String, pub auth_results: AuthResults, pub greylisted: bool, pub virus_found: Option<String>, pub content_score: f64, pub matched_rules: Vec<String>, pub ptr_score: f64, pub ai_score: f64,
}
Expand description

Aggregate state for one SMTP receive transaction.

Constructed at the start of the pipeline from the SMTP envelope + DATA body. Stages take &mut ReceiveContext and mutate the signal fields (auth_results, virus_found, content_score, etc.) as they execute. At the end, the Pipeline executor materializes a PipelineInput from the accumulated state and calls make_delivery_decision.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§client_ip: IpAddr

Client IP that connected and submitted the message.

§ehlo_domain: String

Domain the client claimed in EHLO/HELO.

§sender: String

Envelope MAIL FROM (reverse path).

§recipient: String

Envelope RCPT TO (first / primary recipient).

§message: Vec<u8>

Raw RFC 5322 message body the client transmitted in DATA.

§hostname: String

This server’s own hostname (used in the Authentication-Results header’s authserv-id).

§auth_results: AuthResults

SPF / DKIM / ARC / DMARC verification summary. Stages typically fill auth_results.spf first, then dkim, etc.

§greylisted: bool

true when a greylisting stage decided to defer.

§virus_found: Option<String>

Some(signature_name) when a virus scanner found malware.

§content_score: f64

Rule-engine content score (higher = spammier).

§matched_rules: Vec<String>

Names of rules that fired. Surfaced in the Junk decision’s reason.

§ptr_score: f64

FCrDNS score from a PTR-check stage.

§ai_score: f64

Score from an AI / ML scoring stage.

Implementations§

Source§

impl ReceiveContext

Source

pub fn new( client_ip: IpAddr, ehlo_domain: impl Into<String>, sender: impl Into<String>, recipient: impl Into<String>, message: Vec<u8>, hostname: impl Into<String>, ) -> Self

Construct a fresh context for one receive transaction. All signal fields start zeroed; stages fill them in as the pipeline runs.

Source

pub fn to_pipeline_input(&self, spam_threshold: f64) -> PipelineInput

Materialize a PipelineInput from the accumulated signals, ready to hand to make_delivery_decision.

Trait Implementations§

Source§

impl Clone for ReceiveContext

Source§

fn clone(&self) -> ReceiveContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReceiveContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more