global::envelop
Functions to inspect and mutate the SMTP envelop.
fn
rw_mail_from
fn rw_mail_from(new_addr: SharedObject) -> ()
fn rw_mail_from(new_addr: String) -> ()
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"),
// You can use vsl addresses too.
action "rewrite envelop 2" || envelop::rw_mail_from(address("john.doe@example.com")),
]
}
fn
rw_rcpt
fn rw_rcpt(old_addr: String, new_addr: SharedObject) -> ()
fn rw_rcpt(old_addr: SharedObject, new_addr: SharedObject) -> ()
fn rw_rcpt(old_addr: String, new_addr: String) -> ()
fn rw_rcpt(old_addr: SharedObject, new_addr: String) -> ()
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: [
// You can use strings or addresses as parameters.
action "rewrite envelop 1" || envelop::rw_rcpt("john.doe@example.com", "john.main@example.com"),
action "rewrite envelop 2" || envelop::rw_rcpt(address("john.doe@example.com"), "john.main@example.com"),
action "rewrite envelop 3" || envelop::rw_rcpt("john.doe@example.com", address("john.main@example.com")),
action "rewrite envelop 4" || envelop::rw_rcpt(address("john.doe@example.com"), address("john.main@example.com")),
]
}
fn
add_rcpt
fn add_rcpt(new_addr: SharedObject) -> ()
fn add_rcpt(new_addr: String) -> ()
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 1" || envelop::add_rcpt("john.doe@example.com"),
action "rewrite envelop 2" || envelop::add_rcpt(address("john.doe@example.com")),
]
}
fn
bcc
fn bcc(new_addr: SharedObject) -> ()
fn bcc(new_addr: String) -> ()
Alias for `envelop::add_rcpt`.
fn
rm_rcpt
fn rm_rcpt(addr: SharedObject) -> ()
fn rm_rcpt(addr: String) -> ()
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")),
]
}