[][src]Attribute Macro milter_callback::on_connect

#[on_connect]

Generates a callback function of type ConnectCallback that delegates to the annotated function.

As its sole argument on_connect takes an identifier to be used as the name of the generated function.

The on_connect callback is called at the beginning of an SMTP connection. The signature of the annotated function must be as specified below.

Arguments:

  • Context<T> – the callback context
  • &str – the client’s hostname
  • Option<SocketAddr> – the client’s internet socket address, if any

Return type:

  • Status – the response status

Examples

use milter::{Context, Status};
use std::net::SocketAddr;

#[on_connect(connect_callback)]
fn handle_connect(
    context: Context<MyData>,
    hostname: &str,
    socket_address: Option<SocketAddr>,
) -> Status {
    Status::Continue
}