Skip to content

Commit

Permalink
fix(core): Fix hotmail/outlook checks
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Oct 8, 2023
1 parent 3c6ae00 commit 5e4bf16
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/src/smtp/outlook/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.")
}

0 comments on commit 5e4bf16

Please sign in to comment.