envelop
Namespace: global/envelop
Functions to inspect and mutate the SMTP envelop.
fn
rw_mail_from
fn rw_mail_from(ctx: State<StatefulCtxReceived>, new_addr: String) -> Result<()>
- Description
- Args
- Effective smtp stage
- Examples
Rewrite the sender received from the `MAIL FROM` command.
new_addr
- the new string sender address to set.
mail
and onwards.
#{
preq: [
action "rewrite envelop 1" || envelop::rw_mail_from("unknown@example.com"),
]
}
fn
rw_rcpt
fn rw_rcpt(ctx: State<StatefulCtxReceived>, old_addr: String, new_addr: String) -> Result<()>
- Description
- Args
- Effective smtp stage
- Examples
Replace a recipient received by a `RCPT TO` command.
old_addr
- the recipient to replace.new_addr
- the new address to use when replacingold_addr
.
rcpt
and onwards.
#{
preq: [
action "rewrite envelop" || envelop::rw_rcpt("john.doe@example.com", "john.main@example.com"),
]
}
fn
add_rcpt
fn add_rcpt(ctx: State<StatefulCtxReceived>, new_addr: String) -> Result<()>
- Description
- Args
- Effective smtp stage
- Examples
Add a new recipient to the envelop. Note that this does not add the recipient to the `To` header. Use `msg::add_rcpt` for that.
rcpt
- the new recipient to add.
All of them.
#{
connect: [
// always deliver a copy of the message to "john.doe@example.com".
action "rewrite envelop" || envelop::add_rcpt("john.doe@example.com"),
]
}
fn
bcc
fn bcc(ctx: State<StatefulCtxReceived>, new_addr: String) -> Result<()>
- Description
Alias for `envelop::add_rcpt`.
fn
rm_rcpt
fn rm_rcpt(ctx: State<StatefulCtxReceived>, addr: String) -> Result<()>
- Description
- Args
- Effective smtp stage
- Examples
Remove a recipient from the envelop. Note that this does not remove the recipient from the `To` header. Use `msg::rm_rcpt` for that.
rcpt
- the recipient to remove.
All of them.
#{
preq: [
// never deliver to "john.doe@example.com".
action "rewrite envelop 1" || envelop::rm_rcpt("john.doe@example.com"),
action "rewrite envelop 2" || envelop::rm_rcpt(address("john.doe@example.com")),
]
}