EgretDoc
Back to Home
Location:system/aio.smtp

Module

Module documentation.

moduleaio.smtp

Classes

Classes and inheritance.

classaio.smtp::AsyncConn
@brief`AsyncConn` type.
@details`AsyncConn` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class AsyncConn {
    /*
    @brief `fd` field.
classaio.smtp::Server
@brief`Server` type.
@details`Server` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Server {
    /*
    @brief `host` field.

Functions

Free functions and class methods.

functionaio.smtp::AsyncConn.init
Signaturefunc init(self: aio.smtp.AsyncConn, fd: Int, timeout_ms: Int = 30000) -> Void
    func init(self: aio.smtp.AsyncConn, fd: Int, timeout_ms: Int = 30000) -> Void {
        self.fd = fd;
        self.timeout_ms = timeout_ms;
@briefInitializes a `AsyncConn` instance.
@detailsEstablishes the initial field state for `AsyncConn` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
  • fdOperating-system file descriptor or socket descriptor.
  • timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionaio.smtp::AsyncConn.close
Signaturefunc close(self: aio.smtp.AsyncConn) -> Void
    func close(self: aio.smtp.AsyncConn) -> Void {
        _ = aio.tcp.close(self.fd);
    }
@briefCloses resources and makes later operations unavailable with `AsyncConn.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionaio.smtp::AsyncConn.deinit
Signaturefunc deinit(self: aio.smtp.AsyncConn) -> Void
    func deinit(self: aio.smtp.AsyncConn) -> Void {
    }
}
@briefReleases fallback resources at the end of the `AsyncConn` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionaio.smtp::Server.init
Signaturefunc init(self: aio.smtp.Server, host: String, port: Int, mailbox_dir: String, hostname: String = "egret-smtp") -> Void
    func init(self: aio.smtp.Server, host: String, port: Int, mailbox_dir: String, hostname: String = "egret-smtp") -> Void {
        self.host = host;
        self.port = port;
@briefInitializes a `Server` instance.
@detailsEstablishes the initial field state for `Server` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
  • hostHost name or listen address.
  • portPort number.
  • mailbox_dirFilesystem path or file-related value used by the operation.
  • hostnameHost name or address used for the network operation.
@returnVoid
functionaio.smtp::Server.open
Signaturefunc open(self: aio.smtp.Server) -> ErrCode
    func open(self: aio.smtp.Server) -> ErrCode {
        let mkdir_err: ErrCode = self.mailbox.ensure_dir();
        if mkdir_err != std.OK {
@briefProvides the system library operation `Server.open`.
@detailsExecutes the `open` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionaio.smtp::Server.close
Signaturefunc close(self: aio.smtp.Server) -> Void
    func close(self: aio.smtp.Server) -> Void {
        if self.listen_fd > 0 {
            _ = aio.tcp.close(self.listen_fd);
@briefCloses resources and makes later operations unavailable with `Server.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionaio.smtp::Server.deinit
Signaturefunc deinit(self: aio.smtp.Server) -> Void
    func deinit(self: aio.smtp.Server) -> Void {
    }
}
@briefReleases fallback resources at the end of the `Server` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
  • selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid

Variables

Class fields (var).

varaio.smtp::AsyncConn.fd
TypeInt
@brief`fd` field.
@detailsStores the underlying file descriptor or socket descriptor. The field type is `Int`, and it is maintained by the constructors and methods of `AsyncConn`.
    var fd: Int;
    /*
    @brief `timeout_ms` field.
varaio.smtp::AsyncConn.timeout_ms
TypeInt
@brief`timeout_ms` field.
@detailsStores the default timeout in milliseconds. The field type is `Int`, and it is maintained by the constructors and methods of `AsyncConn`.
    var timeout_ms: Int;
    /*
    @brief `buffer` field.
varaio.smtp::AsyncConn.buffer
TypeString
@brief`buffer` field.
@detailsHolds the `buffer` value for each `AsyncConn` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
    var buffer: String;

    /*
varaio.smtp::Server.host
TypeString
@brief`host` field.
@detailsStores a host name or network address. The field type is `String`, and it is maintained by the constructors and methods of `Server`.
    var host: String;
    /*
    @brief `port` field.
varaio.smtp::Server.port
TypeInt
@brief`port` field.
@detailsStores a port number. The field type is `Int`, and it is maintained by the constructors and methods of `Server`.
    var port: Int;
    /*
    @brief `backlog` field.
varaio.smtp::Server.backlog
TypeInt
@brief`backlog` field.
@detailsHolds the `backlog` value for each `Server` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var backlog: Int;
    /*
    @brief `timeout_ms` field.
varaio.smtp::Server.timeout_ms
TypeInt
@brief`timeout_ms` field.
@detailsStores the default timeout in milliseconds. The field type is `Int`, and it is maintained by the constructors and methods of `Server`.
    var timeout_ms: Int;
    /*
    @brief `buffer` field.
varaio.smtp::Server.max_message_bytes
TypeInt
@brief`max_message_bytes` field.
@detailsHolds the `max_message_bytes` value for each `Server` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var max_message_bytes: Int;
    /*
    @brief `max_connections` field.
varaio.smtp::Server.max_connections
TypeInt
@brief`max_connections` field.
@detailsHolds the `max_connections` value for each `Server` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var max_connections: Int;
    /*
    @brief `mailbox` field.
varaio.smtp::Server.mailbox
Typenet.smtp.FileMailbox
@brief`mailbox` field.
@detailsHolds the `mailbox` value for each `Server` instance. The field type is `net.smtp.FileMailbox`, and constructors and methods keep it synchronized with the object's runtime state.
    var mailbox: net.smtp.FileMailbox;
    /*
    @brief `hostname` field.
varaio.smtp::Server.hostname
TypeString
@brief`hostname` field.
@detailsHolds the `hostname` value for each `Server` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
    var hostname: String;
    /*
    @brief `listen_fd` field.
varaio.smtp::Server.listen_fd
TypeInt
@brief`listen_fd` field.
@detailsHolds the `listen_fd` value for each `Server` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
    var listen_fd: Int;

    /*