-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathreport_arf_generate.rs
More file actions
47 lines (44 loc) · 1.75 KB
/
report_arf_generate.rs
File metadata and controls
47 lines (44 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*/
use mail_auth::report::{AuthFailureType, Feedback, FeedbackType, IdentityAlignment};
fn main() {
// Generate ARF feedback
let feedback = Feedback::new(FeedbackType::AuthFailure)
.with_arrival_date(5934759438)
.with_authentication_results("dkim=pass")
.with_incidents(10)
.with_original_envelope_id("821-abc-123")
.with_original_mail_from("hello@world.org")
.with_original_rcpt_to("ciao@mundo.org")
.with_reported_domain("example.org")
.with_reported_domain("example2.org")
.with_reported_uri("uri:domain.org")
.with_reported_uri("uri:domain2.org")
.with_reporting_mta("Manchegator 2.0")
.with_source_ip("192.168.1.1".parse().unwrap())
.with_user_agent("DMARC-Meister")
.with_version(2)
.with_source_port(1234)
.with_auth_failure(AuthFailureType::Dmarc)
.with_dkim_adsp_dns("v=dkim1")
.with_dkim_canonicalized_body("base64 goes here")
.with_dkim_canonicalized_header("more base64")
.with_dkim_domain("dkim-domain.org")
.with_dkim_identity("my-dkim-identity@domain.org")
.with_dkim_selector("the-selector")
.with_dkim_selector_dns("v=dkim1;")
.with_spf_dns("v=spf1")
.with_identity_alignment(IdentityAlignment::DkimSpf)
.with_message("From: hello@world.org\r\nTo: ciao@mondo.org\r\n\r\n")
.to_rfc5322(
("DMARC Reports", "no-reply@example.org"),
"ruf@otherdomain.com",
"DMARC Authentication Failure Report",
)
.unwrap();
// Print ARF feedback to stdout
println!("{feedback}");
}