Skip to main content

Pop3Connection

Trait Pop3Connection 

Source
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§

Source

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.
Source

fn stat(&mut self) -> Result<Pop3Stat, Box<dyn Error>>

Returns maildrop statistics.

Source

fn list(&mut self) -> Result<Vec<Pop3MessageInfo>, Box<dyn Error>>

Returns id and size of each message.

Source

fn get_message_size(&mut self, message_id: u32) -> Result<u32, Box<dyn Error>>

Returns the size of a given message.

§Arguments
  • message_id - id of the message to query
Source

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 download
  • writer - writer to store message
Source

fn delete(&mut self, message_id: u32) -> Result<(), Box<dyn Error>>

Deletes a given message.

§Arguments
  • message_id - id of the message to download
Source

fn reset(&mut self) -> Result<(), Box<dyn Error>>

Unmark any messages marked as delete.

Source

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 message
  • line_count - count of lines to return from the message body
Source

fn list_unique_ids(&mut self) -> Result<Vec<Pop3MessageUidInfo>, Box<dyn Error>>

Returns the unique ids of all messages.

Source

fn get_unique_id(&mut self, message_id: u32) -> Result<String, Box<dyn Error>>

Returns the unique id of a given message.

§Arguments
  • message_id - id of the message

Implementors§