Function vsmtp_rule_engine::api::message::count_header
pub fn count_header(
ncc: NativeCallContext<'_>,
header: &str
) -> EngineResult<INT>Expand description
Count the number of headers with the given name.
Args
header- the name of the header to count.
Return
number- the number headers with the same name.
Effective smtp stage
All of them, although it is most useful in the preq stage because this
is when the email body is received.
Examples
"X-My-Header: foo\r\n",
"X-My-Header: bar\r\n",
"X-My-Header: baz\r\n",
"Subject: Unit test are cool\r\n",
"\r\n",
"Hello world!\r\n",
#{
preq: [
rule "count_header" || {
state::accept(`250 count is ${msg::count_header("X-My-Header")} and ${msg::count_header(identifier("Subject"))}`);
}
]
}