pub trait Pop3Connection {
// Required methods
fn login(
&mut self,
user: &str,
password: &str,
) -> Result<(), Box<dyn Error>>;
fn stat(&mut self) -> Result<Pop3Stat, Box<dyn Error>>;
fn list(&mut self) -> Result<Vec<Pop3MessageInfo>, Box<dyn Error>>;
fn get_message_size(
&mut self,
message_id: u32,
) -> Result<u32, Box<dyn Error>>;
fn retrieve(
&mut self,
message_id: u32,
writer: &mut dyn Write,
) -> Result<(), Box<dyn Error>>;
fn delete(&mut self, message_id: u32) -> Result<(), Box<dyn Error>>;
fn reset(&mut self) -> Result<(), Box<dyn Error>>;
fn top(
&mut self,
message_id: u32,
line_count: u32,
) -> Result<String, Box<dyn Error>>;
fn list_unique_ids(
&mut self,
) -> Result<Vec<Pop3MessageUidInfo>, Box<dyn Error>>;
fn get_unique_id(
&mut self,
message_id: u32,
) -> Result<String, Box<dyn Error>>;
}Required Methods§
Sourcefn login(&mut self, user: &str, password: &str) -> Result<(), Box<dyn Error>>
fn login(&mut self, user: &str, password: &str) -> Result<(), Box<dyn Error>>
Authenticate a POP3 session using username and password.
This is usually the first set of commands after a POP3 session is established.
§Arguments
user- Name of the user, typically it’s e-mail address.password- Password of the user.
Sourcefn list(&mut self) -> Result<Vec<Pop3MessageInfo>, Box<dyn Error>>
fn list(&mut self) -> Result<Vec<Pop3MessageInfo>, Box<dyn Error>>
Returns id and size of each message.
Sourcefn retrieve(
&mut self,
message_id: u32,
writer: &mut dyn Write,
) -> Result<(), Box<dyn Error>>
fn retrieve( &mut self, message_id: u32, writer: &mut dyn Write, ) -> Result<(), Box<dyn Error>>
Downloads a given message.
§Arguments
message_id- id of the message to downloadwriter- writer to store message
Sourcefn top(
&mut self,
message_id: u32,
line_count: u32,
) -> Result<String, Box<dyn Error>>
fn top( &mut self, message_id: u32, line_count: u32, ) -> Result<String, Box<dyn Error>>
Returns the message header an a given number of lines from the message.
§Arguments
message_id- id of the messageline_count- count of lines to return from the message body
Sourcefn list_unique_ids(&mut self) -> Result<Vec<Pop3MessageUidInfo>, Box<dyn Error>>
fn list_unique_ids(&mut self) -> Result<Vec<Pop3MessageUidInfo>, Box<dyn Error>>
Returns the unique ids of all messages.