Function imap::connect

source ·
pub fn connect<A: ToSocketAddrs>(
    addr: A,
    domain: &str,
    ssl_connector: &TlsConnector
) -> Result<Client<TlsStream<TcpStream>>>
Expand description

Connect to a server using a TLS-encrypted connection.

The returned Client is unauthenticated; to access session-related methods (through Session), use Client::login or Client::authenticate.

The domain must be passed in separately from the TlsConnector so that the certificate of the IMAP server can be validated.

Examples

let tls = TlsConnector::builder().build().unwrap();
let client = imap::connect(("imap.example.org", 993), "imap.example.org", &tls).unwrap();