[][src]Function imap::connect

pub fn connect<A: ToSocketAddrs, S: AsRef<str>>(
    addr: A,
    domain: S,
    ssl_connector: &TlsConnector
) -> Result<Client<TlsStream<TcpStream>>>

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();