rustexamples/report_dmarc_parse.rs -rw-r--r-- 705 B
1/*
2 * Copyright (c) 2020-2023, Stalwart Labs Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 * https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
7 * option. This file may not be copied, modified, or distributed
8 * except according to those terms.
9 */
10
11use mail_auth::report::Report;
12
13const TEST_MESSAGE: &str = include_str!("../resources/dmarc-feedback/100.eml");
14
15fn main() {
16 // Parse DMARC aggregate report
17 let report = Report::parse_rfc5322(TEST_MESSAGE.as_bytes()).unwrap();
18
19 // Write report to stdout at JSPON
20 println!("{}", serde_json::to_string_pretty(&report).unwrap());
21}