Enum vsmtp_common::Context
pub enum Context {
Connect(ContextConnect),
Helo(ContextHelo),
MailFrom(ContextMailFrom),
RcptTo(ContextRcptTo),
Finished(ContextFinished),
}Expand description
A step-by-step SMTP envelop produced by the transaction
Variants§
Connect(ContextConnect)
See Stage::Connect
Helo(ContextHelo)
See Stage::Helo
MailFrom(ContextMailFrom)
See Stage::MailFrom
RcptTo(ContextRcptTo)
See Stage::RcptTo
Finished(ContextFinished)
See Stage::Finished
Implementations§
§impl Context
impl Context
pub fn reset(&mut self)
pub fn reset(&mut self)
Called when a “RSET” is issued
pub fn new(
client_addr: SocketAddr,
server_addr: SocketAddr,
server_name: Domain,
timestamp: OffsetDateTime,
uuid: Uuid
) -> Self
pub fn new( client_addr: SocketAddr, server_addr: SocketAddr, server_name: Domain, timestamp: OffsetDateTime, uuid: Uuid ) -> Self
Convert the context to a [ContextConnect]
pub fn to_helo(
&mut self,
client_name: ClientName,
using_deprecated: bool
) -> Result<&mut Self, Error>
pub fn to_helo( &mut self, client_name: ClientName, using_deprecated: bool ) -> Result<&mut Self, Error>
Convert the context to a [ContextHelo] or overwrite the existing one
Errors
- state if not
Stage::HeloorStage::MailFrom
pub fn with_credentials(
&mut self,
credentials: Credentials
) -> Result<(), Error>
pub fn with_credentials( &mut self, credentials: Credentials ) -> Result<(), Error>
Set the credentials used by the client during the SASL handshake
Errors
- state if not
Stage::HeloorStage::MailFrom
pub fn to_mail_from(
&mut self,
reverse_path: Option<Address>
) -> Result<(), Error>
pub fn to_mail_from( &mut self, reverse_path: Option<Address> ) -> Result<(), Error>
Convert the context to a [ContextMailFrom] or overwrite the existing one
Errors
- state if not
Stage::HeloorStage::MailFrom
pub fn to_finished(&mut self) -> Result<(), Error>
pub fn to_finished(&mut self) -> Result<(), Error>
pub fn set_skipped(&mut self, status: Status)
pub fn set_skipped(&mut self, status: Status)
pub fn connection_timestamp(&self) -> &OffsetDateTime
pub fn connection_timestamp(&self) -> &OffsetDateTime
Get the timestamp of the TCP/IP connection
pub fn connection_uuid(&self) -> &Uuid
pub fn connection_uuid(&self) -> &Uuid
Get the uuid of the TCP/IP connection
pub fn client_addr(&self) -> &SocketAddr
pub fn client_addr(&self) -> &SocketAddr
Get the address of the socket client
pub fn server_addr(&self) -> &SocketAddr
pub fn server_addr(&self) -> &SocketAddr
Get the address of the socket server which accepted the connection
pub fn server_name(&self) -> &Domain
pub fn server_name(&self) -> &Domain
Get the name of the server which the client connected to.
pub fn is_secured(&self) -> bool
pub fn is_secured(&self) -> bool
Is the connection been encrypted using the SMTP+TLS protocol?
pub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Is the connection been authenticated using the SMTP+SASL protocol?
pub fn to_secured(
&mut self,
sni: Option<Domain>,
protocol_version: ProtocolVersion,
cipher_suite: CipherSuite,
peer_certificates: Option<Vec<Certificate>>,
alpn_protocol: Option<Vec<u8>>
) -> Result<(), Error>
pub fn to_secured( &mut self, sni: Option<Domain>, protocol_version: ProtocolVersion, cipher_suite: CipherSuite, peer_certificates: Option<Vec<Certificate>>, alpn_protocol: Option<Vec<u8>> ) -> Result<(), Error>
pub fn client_name(&self) -> Result<&ClientName, Error>
pub fn client_name(&self) -> Result<&ClientName, Error>
pub fn tls(&self) -> &Option<TlsProperties>
pub fn tls(&self) -> &Option<TlsProperties>
Get the TlsProperties of the connection.
pub fn auth(&self) -> &Option<AuthProperties>
pub fn auth(&self) -> &Option<AuthProperties>
Get the AuthProperties of the connection.
pub fn auth_mut(&mut self) -> Option<&mut AuthProperties>
pub fn auth_mut(&mut self) -> Option<&mut AuthProperties>
Get the mutable reference AuthProperties of the connection.
pub fn to_auth(&mut self) -> Result<&mut AuthProperties, Error>
pub fn to_auth(&mut self) -> Result<&mut AuthProperties, Error>
pub fn reverse_path(&self) -> Result<&Option<Address>, Error>
pub fn reverse_path(&self) -> Result<&Option<Address>, Error>
pub fn mail_timestamp(&self) -> Result<&OffsetDateTime, Error>
pub fn mail_timestamp(&self) -> Result<&OffsetDateTime, Error>
Get the time::OffsetDateTime when the MAIL FROM has been received.
Errors
- state if not
Stage::MailFromor after
pub fn message_uuid(&self) -> Result<&Uuid, Error>
pub fn message_uuid(&self) -> Result<&Uuid, Error>
pub fn generate_message_id(&mut self) -> Result<(), Error>
pub fn generate_message_id(&mut self) -> Result<(), Error>
pub fn add_forward_path(
&mut self,
forward_path: Address,
transport: Arc<dyn AbstractTransport>
) -> Result<(), Error>
pub fn add_forward_path( &mut self, forward_path: Address, transport: Arc<dyn AbstractTransport> ) -> Result<(), Error>
Add a recipient at the end of the list of forward paths.
If the state was Stage::MailFrom, the state is changed to Stage::RcptTo.
Errors
- state if not
Stage::MailFromor after
pub fn remove_forward_path(
&mut self,
forward_path: &Address
) -> Result<bool, Error>
pub fn remove_forward_path( &mut self, forward_path: &Address ) -> Result<bool, Error>
Remove the first recipient with the address forward_path.
Return false if no such recipient exist
Errors
- state if not
Stage::RcptToor after
pub fn forward_paths(&self) -> Result<&Vec<Address>, Error>
pub fn forward_paths(&self) -> Result<&Vec<Address>, Error>
pub fn forward_paths_mut(&mut self) -> Result<&mut Vec<Address>, Error>
pub fn forward_paths_mut(&mut self) -> Result<&mut Vec<Address>, Error>
pub fn set_transport_for_one(
&mut self,
search: &Address,
transport: Arc<dyn AbstractTransport>
) -> Result<(), Error>
pub fn set_transport_for_one( &mut self, search: &Address, transport: Arc<dyn AbstractTransport> ) -> Result<(), Error>
pub fn set_transport_foreach(
&mut self,
transport: Arc<dyn AbstractTransport>
) -> Result<(), Error>
pub fn set_transport_foreach( &mut self, transport: Arc<dyn AbstractTransport> ) -> Result<(), Error>
pub fn delivery(&self) -> Result<&HashMap<WrapperSerde, DeliverTo>, Error>
pub fn delivery(&self) -> Result<&HashMap<WrapperSerde, DeliverTo>, Error>
Errors
- state if not
Stage::RcptToor after
pub fn delivery_mut(
&mut self
) -> Result<&mut HashMap<WrapperSerde, DeliverTo>, Error>
pub fn delivery_mut( &mut self ) -> Result<&mut HashMap<WrapperSerde, DeliverTo>, Error>
Errors
- state if not
Stage::RcptToor after
pub fn transaction_type(&self) -> Result<&TransactionType, Error>
pub fn transaction_type(&self) -> Result<&TransactionType, Error>
pub fn set_transaction_type(
&mut self,
transaction_type: TransactionType
) -> Result<(), Error>
pub fn set_transaction_type( &mut self, transaction_type: TransactionType ) -> Result<(), Error>
Set the TransactionType.
If the state was Stage::MailFrom, the state is changed to Stage::RcptTo.
Errors
- state if not
Stage::MailFromor after