pub fn auth(&mut self, mechanism: Mechanism, credentials: &Credentials) -> SmtpResult {
        // TODO
        let mut challenges = 10;
        let mut response = self.command(AuthCommand::new(mechanism, credentials.clone(), None)?)?;

        while challenges > 0 && response.has_code(334) {
            challenges -= 1;
            response = self.command(AuthCommand::new_from_response(
                mechanism,
                credentials.clone(),
                &response,
            )?)?;
        }

        if challenges == 0 {
            Err(Error::ResponseParsing("Unexpected number of challenges"))
        } else {
            Ok(response)
        }
    }
/// Sends an AUTH command with the given mechanism, and handles challenge if needed
Sends an AUTH command with the given mechanism, and handles challenge if needed
Sends an AUTH command with the given mechanism and handles challenge if needed
pub fn auth(&mut self, mechanism: Mechanism, credentials: &Credentials) -> SmtpResult {
        // TODO
        let mut challenges = 10;
        let mut response = self.command(AuthCommand::new(mechanism, credentials.clone(), None)?)?;
        while challenges > 0 && response.has_code(334) {
            challenges -= 1;
            response = self.command(AuthCommand::new_from_response(
                mechanism,
                credentials.clone(),
                &response,
            )?)?;
        }
        if challenges == 0 {
            Err(Error::ResponseParsing("Unexpected number of challenges"))
        } else {
            Ok(response)
        }
    }
pub fn auth ( & mut self , mechanism : Mechanism , credentials : & Credentials ) -> SmtpResult { // TODO let mut challenges = 10 ; let mut response = self . command ( AuthCommand :: new ( mechanism , credentials . clone ( ) , None ) ? ) ? ; while challenges > 0 && response . has_code ( 334 ) { challenges -= 1 ; response = self . command ( AuthCommand :: new_from_response ( mechanism , credentials . clone ( ) , & response , ) ? ) ? ; } if challenges == 0 { Err ( Error :: ResponseParsing ( " " ) ) } else { Ok ( response ) } }
Sends an AUTH command with the given mechanism, and handles challenge if needed
Sends an AUTH command with the given mechanism and handles challenge if needed
&mut self
mechanism
Mechanism
credentials
&Credentials
&mut self
mechanism
Mechanism
credentials
&Credentials