stalwartlabs/mail-auth

Please consider making parsing results available

Closed this issue · 1 comments

Hey,

I found your code in a search for a good parser for SPF and Dmarc records. I like the TxtRecordParser for the Spf, DKIM and Dmarc structs and would like to use them. My code would do some OSINT / Scanning work and I'd like it not to rely on a received message. Could you consider making the parsing results public?

Some minimal code:

use mail_auth::{common::parse::TxtRecordParser, spf::Spf};


fn main() {
    let spf_record = "v=spf1 A MX -all";
    match Spf::parse(spf_record.as_bytes()) {
        Ok(parsed_record) => {
            println!("SPF Version: {}", parsed_record.version);
        }, 
        Err(_) => { println!("Whoops"); }
    }
}

And the error:

cargo run 
   Compiling example v0.1.0 (???/email_headers/example)
error[E0616]: field `version` of struct `mail_auth::spf::Spf` is private
 --> src/main.rs:8:55
  |
8 |             println!("SPF Version: {}", parsed_record.version);
  |                                                       ^^^^^^^ private field

For more information about this error, try `rustc --explain E0616`.
error: could not compile `example` (bin "example") due to 1 previous error

Thanks!

Sure, can you submit a PR for this?