crabmail

Static HTML email archive viewer in Rust
git clone git://git.alexwennerberg.com/crabmail
Log | Files | Refs | README | LICENSE

commit ca0d100118acbee6d9a7040d2fc49613bb0d8f48
parent bd34058ac1ab759d4e31254ff4f405f854bde4a5
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 20 Mar 2022 14:31:18 -0700

fix to/cc in email export

Diffstat:
MTODO | 3---
Msrc/models.rs | 14+++++++++++---
2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/TODO b/TODO @@ -2,10 +2,7 @@ TODO ==== atom feeds working -> pull last x into threads paginate list home -fix "to" in email export reference mblaze command, add examples to readme -fix all the build warnings -remove unused fix docs check for html escape bugz diff --git a/src/models.rs b/src/models.rs @@ -133,10 +133,18 @@ impl StrMessage { let from = self.from.name.clone().unwrap_or(String::new()); message.message_id(self.id.as_str()); message.from((from.as_str(), self.from.address.as_str())); - // TODO fix to - message.to("jane@doe.com"); + // TODO no alloc. No copy pasta + message.to(self + .to + .iter() + .map(|x| (x.name.clone().unwrap_or(String::new()), x.address.clone())) + .collect::<Vec<(String, String)>>()); + message.cc(self + .cc + .iter() + .map(|x| (x.name.clone().unwrap_or(String::new()), x.address.clone())) + .collect::<Vec<(String, String)>>()); message.header("Date", Text::from(self.date.as_str())); - // cc if let Some(irt) = &self.in_reply_to { message.in_reply_to(irt.as_str()); }