pub fn remove_header(
    ncc: NativeCallContext<'_>,
    header: &str
) -> EngineResult<bool>
Expand description

Remove an existing header from the message.

Args

  • header - the name of the header to remove.

Return

  • a boolean value, true if a header has been removed, false otherwise.

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

"Subject: The initial header value\r\n",
"\r\n",
"Hello world!\r\n",
#{
  preq: [
    rule "remove_header" || {
      msg::rm_header("Subject");
      if msg::has_header("Subject") { return state::deny(); }

      msg::prepend_header("Subject-2", "Rust is good");
      msg::rm_header(identifier("Subject-2"));

      msg::prepend_header("Subject-3", "Rust is good !!!!!");

      state::accept(`250 ${msg::get_header("Subject-3")}`);
    }
  ]
}

rhai-autodocs:index:12