letterman_email_body_parser

Crates.ioletterman_email_body_parser
lib.rsletterman_email_body_parser
version1.0.5
sourcesrc
created_at2021-12-08 15:25:22.074808
updated_at2022-03-04 22:39:52.911311
descriptionthis is a tokio based fast and optimized email body parser and dkim validator.
homepagehttps://github.com/gzbakku/letterman_email_body_parser
repositoryhttps://github.com/gzbakku/letterman_email_body_parser
max_upload_size
id494573
size137,345
akku (gzbakku)

documentation

README

letterman_email_body_parser

this is a tokio based email body parser and dkim validator, the input should not include the data end flag "\r\n.\r\n",dkim keys are cached in a tokio RwLock for fatser reads, if no dkim is provided validation returns successfull.

sample code


use letterman_email_body_parser::{init,Config,io};

#[tokio::main]
async fn main() {

    //io is for testing this is exposed as a module so keep that in mind
    let value:String;
    match io::read_string("./gl_alt_atch.txt"){
        Ok(v)=>{value = v;},
        Err(_)=>{
            println!("failed-read_file");
            return;
        }
    }

    let hold:Vec<&str> = value.split("\r\n").collect();
  
    let conf:Config;
    match Config::new(){
        Ok(v)=>{conf = v;},
        Err(_)=>{
            println!("failed-conf");
            return;
        }
    }

    match init(hold,&conf){
        Ok(mut email)=>{
            println!("email body parsed");
            match email.validate(&conf).await{
                Ok(_)=>{
                    println!("email validated");
                },
                Err(_e)=>{
                    println!("email validation failed : {:?}",_e);
                }
            }
        },
        Err(_e)=>{
            println!("email body failed : {:?}",_e);
        }
    }

}

Commit count: 12

cargo fmt