Add quit command

Signed-off-by: Andrei Zisu <matzipan@gmail.com>
pull/309/head
Andrei Zisu 8 months ago
parent 7aec5b8e78
commit 3105a0373b

@ -70,6 +70,7 @@
//! Address::try_from("foo-chat@example.com").unwrap(), //! Address::try_from("foo-chat@example.com").unwrap(),
//! ]), //! ]),
//! )).unwrap(); //! )).unwrap();
//! futures::executor::block_on(conn.quit()).unwrap();
//! Ok(()) //! Ok(())
//! ``` //! ```
@ -807,6 +808,12 @@ impl SmtpConnection {
} }
Ok(()) Ok(())
} }
pub async fn quit(&mut self) -> Result<()> {
self.send_command(&[b"QUIT"]).await?;
Ok(())
}
} }
/// Expected reply code in a single or multi-line reply by the server /// Expected reply code in a single or multi-line reply by the server
@ -1317,6 +1324,7 @@ mod test {
]), ]),
)) ))
.unwrap(); .unwrap();
futures::executor::block_on(connection.quit()).unwrap();
assert_eq!(handler.stored.lock().unwrap().len(), 2); assert_eq!(handler.stored.lock().unwrap().len(), 2);
} }
} }

Loading…
Cancel
Save