|
@@ -45,6 +45,7 @@ use wasmedge_wasi_socket::{Shutdown, TcpListener, TcpStream};
|
|
use crate::server_wasi::{handle_client};
|
|
use crate::server_wasi::{handle_client};
|
|
#[cfg(target_os = "wasi")]
|
|
#[cfg(target_os = "wasi")]
|
|
use crate::smtp_client::{send_email};
|
|
use crate::smtp_client::{send_email};
|
|
|
|
+use crate::util::{compress_and_save_file, read_and_decompress_file};
|
|
|
|
|
|
mod smtp_client;
|
|
mod smtp_client;
|
|
|
|
|
|
@@ -177,11 +178,17 @@ fn persist_email(msg: &Message, uid: u32, list: String, original_path: PathBuf)
|
|
};
|
|
};
|
|
message.set_path(relative_path.display().to_string());
|
|
message.set_path(relative_path.display().to_string());
|
|
if Config::global().include_html {
|
|
if Config::global().include_html {
|
|
- let html = append_ext("html", &message_dir.join(message.hash.clone()));
|
|
|
|
- let mut file = File::create(html)?;
|
|
|
|
|
|
+ // let html = append_ext("html", &message_dir.join(message.hash.clone()));
|
|
|
|
+ // let mut file = File::create(html)?;
|
|
|
|
+ // let data = message_to_html(message.clone());
|
|
|
|
+ // file.write_all(data.as_bytes())?;
|
|
|
|
+ // file.flush()?;
|
|
|
|
+
|
|
let data = message_to_html(message.clone());
|
|
let data = message_to_html(message.clone());
|
|
- file.write_all(data.as_bytes())?;
|
|
|
|
- file.flush()?;
|
|
|
|
|
|
+ match compress_and_save_file(message_dir.clone(), message.hash.clone(), data.as_bytes()){
|
|
|
|
+ Ok(_) => {}
|
|
|
|
+ Err(_) => {println!("Error while compressing or saving {}", message.hash.clone())}
|
|
|
|
+ };
|
|
}
|
|
}
|
|
|
|
|
|
// xml
|
|
// xml
|
|
@@ -367,6 +374,7 @@ async fn main() -> anyhow::Result<()> {
|
|
async fn main() {
|
|
async fn main() {
|
|
run().await;
|
|
run().await;
|
|
|
|
|
|
|
|
+
|
|
// let email = LettreMessage::builder()
|
|
// let email = LettreMessage::builder()
|
|
// .from("sokolovskiiyura@outlook.com".parse().unwrap())
|
|
// .from("sokolovskiiyura@outlook.com".parse().unwrap())
|
|
// .to("sokolovskiiyura@gmail.com".parse().unwrap())
|
|
// .to("sokolovskiiyura@gmail.com".parse().unwrap())
|
|
@@ -390,9 +398,9 @@ async fn main() {
|
|
|
|
|
|
|
|
|
|
// looking for updates
|
|
// looking for updates
|
|
- let imap_update_handle = tokio::spawn(async move {
|
|
|
|
- imap::check_for_updates("INBOX".to_string()).await.expect("TODO: panic message");
|
|
|
|
- });
|
|
|
|
|
|
+ // let imap_update_handle = tokio::spawn(async move {
|
|
|
|
+ // imap::check_for_updates("INBOX".to_string()).await.expect("TODO: panic message");
|
|
|
|
+ // });
|
|
|
|
|
|
|
|
|
|
// imap::create_folder("testFolder".to_string()).await.unwrap();
|
|
// imap::create_folder("testFolder".to_string()).await.unwrap();
|