From 44e226f8b4851e2fae62e4f4b960e6b09e3e7712 Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaury1729@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:20:58 +0200 Subject: [PATCH] fix(core): Fix hotmail/outlook checks --- core/src/smtp/outlook/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/smtp/outlook/mod.rs b/core/src/smtp/outlook/mod.rs index 3c8c9c077..9bcb209f5 100644 --- a/core/src/smtp/outlook/mod.rs +++ b/core/src/smtp/outlook/mod.rs @@ -4,9 +4,12 @@ pub mod microsoft365; /// Check if a MX host is from outlook (includes @hotmail.*, @outlook.* and /// all Microsoft 365 addresses). +/// +/// After some testing I got: +/// - @outlook.* and @hotmail.* -> end with ".olc.protection.outlook.com." +/// - Microsoft 365 emails -> end with ".mail.protection.outlook.com." pub fn is_outlook(host: &str) -> bool { - host.to_lowercase() - .ends_with(".mail.protection.outlook.com.") + host.to_lowercase().ends_with(".protection.outlook.com.") } /// Check if a MX host is an @hotmail.* or @outlook.* email. @@ -18,8 +21,10 @@ pub fn is_outlook(host: &str) -> bool { /// - *@hotmail.fr -> `eur.olc.protection.outlook.com.` /// - *@hotmail.nl -> `eur.olc.protection.outlook.com.` /// +/// But Microsoft 365 addresses end with "mail.protection.outlook.com." +/// /// So it seems that outlook/hotmail addresses end with `olc.protection.outlook.com.` pub fn is_hotmail(host: &str) -> bool { host.to_lowercase() - .ends_with(".mail.protection.outlook.com.") + .ends_with(".olc.protection.outlook.com.") }