context
Namespace: global/context
Inspect the transaction context.
fn
to_debug
fn to_debug(ctx: State<StatefulCtxReceived>) -> String
- Description
fn
set_routing_path
fn set_routing_path(ctx: State<StatefulCtxReceived>, rcpt: Recipient>, path: String) -> Result<()>
- Description
fn
client_address
fn client_address(ctx: State<StatefulCtxReceived>) -> String
- Description
- Effective smtp stage
- Return
- Examples
Get the address of the client.
All of them.
string
- the client's address with theip:port
format.
#{
connect: [
action "log client address" || {
log("info", `new client: ${ctx::client_address()}`);
},
],
}
get
client_ip
fn get client_ip(ctx: State<StatefulCtxReceived>) -> String
- Description
- Effective smtp stage
- Return
- Example
Get the ip address of the client.
All of them.
string
- the client's ip address.
#{
connect: [
action "log client ip" || {
log("info", `new client: ${ctx::client_ip()}`);
},
],
}
fn
client_port
fn client_port(ctx: State<StatefulCtxReceived>) -> int
- Description
- Effective smtp stage
- Return
- Example
Get the ip port of the client.
All of them.
int
- the client's port.
#{
connect: [
action "log client address" || {
log("info", `new client: ${ctx::client_ip()}:${ctx::client_port()}`);
},
],
}
fn
server_address
fn server_address(ctx: State<StatefulCtxReceived>) -> String
- Description
- Effective smtp stage
- Return
- Example
Get the full server address.
All of them.
string
- the server's address with theip:port
format.
#{
connect: [
action "log server address" || {
log("info", `server: ${ctx::server_address()}`);
},
],
}
fn
server_ip
fn server_ip(ctx: State<StatefulCtxReceived>) -> String
- Description
- Effective smtp stage
- Return
- Example
Get the server's ip.
All of them.
string
- the server's ip.
#{
connect: [
action "log server ip" || {
log("info", `server: ${ctx::server_ip()}`);
},
],
}
fn
server_port
fn server_port(ctx: State<StatefulCtxReceived>) -> int
- Description
- Effective smtp stage
- Return
- Example
Get the server's port.
All of them.
string
- the server's port.
#{
connect: [
action "log server address" || {
log("info", `server: ${ctx::server_ip()}:${ctx::server_port()}`);
},
],
}
fn
connection_timestamp
fn connection_timestamp(ctx: State<StatefulCtxReceived>) -> OffsetDateTime
- Description
- Effective smtp stage
- Return
- Example
Get a the timestamp of the client's connection time.
All of them.
timestamp
- the connection timestamp of the client.
#{
connect: [
action "log client" || {
log("info", `new client connected at ${ctx::connection_timestamp()}`);
},
],
}
fn
server_name
fn server_name(ctx: State<StatefulCtxReceived>) -> String
- Description
- Effective smtp stage
- Return
- Example
Get the name of the server.
All of them.
string
- the name of the server.
#{
connect: [
action "log server" || {
log("info", `server name: ${ctx::server_name()}`);
},
],
}
fn
is_secured
fn is_secured(_ctx: State<StatefulCtxReceived>) -> bool
- Description
- Effective smtp stage
- Return
- Example
Has the connection been secured under the encryption protocol SSL/TLS.
all of them.
- bool -
true
if the connection is secured,false
otherwise.
#{
connect: [
action "log ssl/tls" || {
log("info", `The client is ${if ctx::is_secured() { "secured" } else { "unsecured!!!" }}`)
}
],
}
get
helo
fn get helo(ctx: State<StatefulCtxReceived>) -> Result<String>
- Description
- Effective smtp stage
- Return
- Examples
Get the value of the `HELO/EHLO` command sent by the client.
helo
and onwards.
string
- the value of theHELO/EHLO
command.
#{
helo: [
action "log info" || log("info", `helo/ehlo value: ${ctx::helo()}`),
]
}
get
sender
fn get sender(ctx: State<StatefulCtxReceived>) -> ?>
- Description
- Effective smtp stage
- Return
- Examples
Get the value of the `MAIL FROM` command sent by the client.
mail
and onwards.
String
or ""
(for null reverse path))
#{
helo: [
action "log info" || log("info", `received sender: ${ctx::sender()}`),
]
}
get
recipients
fn get recipients(ctx: State<StatefulCtxReceived>) -> Array>
- Description
- Effective smtp stage
- Return
- Examples
Get the list of recipients received by the client.
rcpt
and onwards. Note that you will not have all recipients received
all at once in the rcpt
stage. It is better to use this function
in the later stages.
Array of addresses
- the list containing all recipients.
#{
preq: [
action "log recipients" || log("info", `recipients: ${ctx::recipients()}`),
]
}
get
domain
fn get domain(ctx: Recipient>) -> String
fn get domain(ctx: Mailbox) -> String
- Description
Get the recipient's domain.
get
local_part
fn get local_part(ctx: Recipient>) -> String
- Description
get
address
fn get address(ctx: Recipient>) -> String
- Description
get
is_null
fn get is_null(mailbox: ?) -> bool
- Description
fn
mail_timestamp
fn mail_timestamp(ctx: State<StatefulCtxReceived>) -> OffsetDateTime>
- Description
- Effective smtp stage
- Return
- Examples
Get the time of reception of the email.
preq
and onwards.
string
- the timestamp.
#{
preq: [
action "receiving the email" || log("info", `time of reception: ${ctx::mail_timestamp()}`),
]
}
get
message_id
fn get message_id(ctx: State<StatefulCtxReceived>) -> Result<String>
- Description
- Effective smtp stage
- Return
- Examples
Get the unique id of the received message.
preq
and onwards.
string
- the message id.
#{
preq: [
action "message received" || log("info", `message id: ${ctx::message_id()}`),
]
}