Skip to main content

message

Namespace: global/message

Inspect incoming messages.

fn mail_str

fn mail_str(ctx: State<StatefulCtxReceived>) -> Result<String>
Get a copy of the whole email as a string.

get mail

fn get mail(ctx: State<StatefulCtxReceived>) -> RwLock<Mail>>>
Get a reference to the email.

fn to_debug

fn to_debug(mail: RwLock<Mail>>) -> String
Return a debug string of the email.

fn has_header

fn has_header(ctx: State<StatefulCtxReceived>, header: String) -> Result<bool>
Checks if the message contains a specific header.

fn count_header

fn count_header(ctx: State<StatefulCtxReceived>, header: String) -> int>
Count the number of headers with the given name.

fn get_header

fn get_header(ctx: State<StatefulCtxReceived>, header: String) -> ?>
Get a specific header from the incoming message.

fn get_all_headers

fn get_all_headers(ctx: State<StatefulCtxReceived>) -> Array>
fn get_all_headers(ctx: State<StatefulCtxReceived>, name: String) -> Array>
Get a list of all headers.

fn get_header_untouched

fn get_header_untouched(ctx: State<StatefulCtxReceived>, name: String) -> Array>
Get a list of all headers of a specific name with it's name and value separated by a column.

fn append_header

fn append_header(ctx: State<StatefulCtxReceived>, name: String, body: String) -> Result<()>
Add a new header **at the end** of the header list in the message.

fn prepend_header

fn prepend_header(ctx: State<StatefulCtxReceived>, header: String, value: String) -> Result<()>
Add a new header on top all other headers in the message.

fn set_header

fn set_header(ctx: State<StatefulCtxReceived>, header: String, value: String) -> Result<()>
Replace an existing header value by a new value, or append a new header to the message.

fn rename_header

fn rename_header(ctx: State<StatefulCtxReceived>, old: String, new: String) -> Result<()>
Replace an existing header name by a new value.

fn rm_header

fn rm_header(ctx: State<StatefulCtxReceived>, header: String) -> Result<bool>
Remove an existing header from the message.

fn rw_mail_from

fn rw_mail_from(ctx: State<StatefulCtxReceived>, new_addr: String) -> Result<()>
Change the sender's address in the `From` header of the message.

fn rw_rcpt

fn rw_rcpt(ctx: State<StatefulCtxReceived>, old_addr: String, new_addr: String) -> Result<()>
Replace a recipient by an other in the `To` header of the message.

fn add_rcpt

fn add_rcpt(ctx: State<StatefulCtxReceived>, new_addr: String) -> Result<()>
Add a recipient to the `To` header of the message.

fn rm_rcpt

fn rm_rcpt(ctx: State<StatefulCtxReceived>, addr: String) -> Result<()>
Remove a recipient from the `To` header of the message.

fn body_string

fn body_string(ctx: State<StatefulCtxReceived>) -> Result<String>
Get the body of the email as a string.