diff --git a/crates/relay/src/deliver/client.rs b/crates/relay/src/deliver/client.rs
index 85d4bf32..67aa4392 100644
--- a/crates/relay/src/deliver/client.rs
+++ b/crates/relay/src/deliver/client.rs
@@ -284,6 +284,7 @@ pub struct Ehlo {
pub eight_bit: bool,
pub smtputf8: bool,
pub dsn: bool,
+ pub requiretls: bool,
}
impl Ehlo {
@@ -301,6 +302,7 @@ impl Ehlo {
"8BITMIME" => ehlo.eight_bit = true,
"SMTPUTF8" => ehlo.smtputf8 = true,
"DSN" => ehlo.dsn = true,
+ "REQUIRETLS" => ehlo.requiretls = true,
_ => {}
}
}
@@ -308,6 +310,11 @@ impl Ehlo {
}
}
+/// Whether the downstream sent the message with REQUIRETLS (RFC 8689).
+pub fn requires_tls(from: &Address) -> bool {
+ parameter(from, "REQUIRETLS").is_some()
+}
+
/// The value of an SMTP parameter, if the downstream gave it.
fn parameter<'a>(address: &'a Address, name: &str) -> Option