diff --git a/imag-mail/src/main.rs b/imag-mail/src/main.rs index ab324c94..bdd51bdb 100644 --- a/imag-mail/src/main.rs +++ b/imag-mail/src/main.rs @@ -93,7 +93,48 @@ fn list(rt: &Runtime) { }; fn list_mail(m: Mail) { - unimplemented!() + let id = match m.get_message_id() { + Ok(Some(f)) => f, + Ok(None) => "".to_owned(), + Err(e) => { + trace_error(&e); + "".to_owned() + }, + }; + + let from = match m.get_from() { + Ok(Some(f)) => f, + Ok(None) => "".to_owned(), + Err(e) => { + trace_error(&e); + "".to_owned() + }, + }; + + let to = match m.get_to() { + Ok(Some(f)) => f, + Ok(None) => "".to_owned(), + Err(e) => { + trace_error(&e); + "".to_owned() + }, + }; + + let subject = match m.get_subject() { + Ok(Some(f)) => f, + Ok(None) => "".to_owned(), + Err(e) => { + trace_error(&e); + "".to_owned() + }, + }; + + println!("Mail: {id}\n\tFrom: {from}\n\tTo: {to}\n\t{subj}\n", + from = from, + id = id, + subj = subject, + to = to + ); } // TODO: Implement lister type in libimagmail for this