Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(email): expand generic email classifier domains and keywords (#4723)
Evan Hutnik08bf6d162d71
diff --git a/rust/cloud-storage/email_utils/src/generic_email/mod.rs b/rust/cloud-storage/email_utils/src/generic_email/mod.rsindex f21240e858..ff45fa36ad 100644--- a/rust/cloud-storage/email_utils/src/generic_email/mod.rs+++ b/rust/cloud-storage/email_utils/src/generic_email/mod.rs@@ -76,8 +76,32 @@ fn is_automated_domain(domain: &str) -> bool {// Support platforms"zendesk.com","freshdesk.com",+ "freshservice.com","notifications.google.com",+ "bounces.google.com",+ // ESP sending/bounce domains+ "mcsv.net",+ "mcdlv.net",+ "customeriomail.com",+ "sparkpostmail.com",+ "mtasv.net",+ "pipedrivemail.com",+ "mailersend.net",+ "mailerlite.com",+ "activehosted.com",+ "sailthru.com",+ "exacttarget.com",+ "smtp2go.com",+ "elasticemail.com",+ "sendpulse.com",+ "getresponse.com",+ "aweber.com",+ // Product notification domains (no human senders)+ "facebookmail.com",+ "docusign.net",+ "atlassian.net",+ "qemailserver.com",];SYSTEM_DOMAINS@@ -101,6 +125,13 @@ fn contains_automated_keyword(local_part: &str) -> bool {"automated","mailer-daemon","postmaster",+ "notification",+ "newsletter",+ "invitation",+ "donotrespond",+ "do-not-respond",+ "do.not.respond",+ "do_not_respond",];STRONG_KEYWORDS.iter().any(|kw| local_part.contains(kw))@@ -139,6 +170,18 @@ fn starts_with_automated_prefix(local_part: &str) -> bool {"weekly","daily","monthly",+ "reminder",+ "reminders",+ "message",+ "messages",+ // Calendar/Scheduling+ "calendar",+ "invite",+ "invites",+ "appointment",+ "appointments",+ "meeting",+ "meetings",// Support/Service"support","help",@@ -169,6 +212,12 @@ fn starts_with_automated_prefix(local_part: &str) -> bool {// Accounts/Auth"account","accounts",+ "activation",+ "registration",+ "registrations",+ "membership",+ "members",+ "fraud","auth","authentication","login",@@ -201,6 +250,15 @@ fn starts_with_automated_prefix(local_part: &str) -> bool {"receipts","order","orders",+ "statement",+ "statements",+ "payroll",+ "expense",+ "expenses",+ "rewards",+ "loyalty",+ "donation",+ "donations",// Shipping/Delivery"shipping","delivery",@@ -208,7 +266,10 @@ fn starts_with_automated_prefix(local_part: &str) -> bool {"tracking","booking","bookings",+ "reservation","reservations",+ "ticket",+ "tickets",// Marketing/Comms"marketing","promo",@@ -218,10 +279,16 @@ fn starts_with_automated_prefix(local_part: &str) -> bool {"news","newsletter","updates",+ "update","info","information","feedback","survey",+ "surveys",+ "webinar",+ "webinars",+ "community",+ "onboarding",// Business departments"sales","hr",@@ -236,6 +303,11 @@ fn starts_with_automated_prefix(local_part: &str) -> bool {"jobs","applications","events",+ "recruiting",+ "recruitment",+ "concierge",+ "report",+ "reports",// Dev/API"dev","developer",diff --git a/rust/cloud-storage/email_utils/src/generic_email/test.rs b/rust/cloud-storage/email_utils/src/generic_email/test.rsindex 5eeda1ecbe..a1ce844639 100644--- a/rust/cloud-storage/email_utils/src/generic_email/test.rs+++ b/rust/cloud-storage/email_utils/src/generic_email/test.rs@@ -138,6 +138,98 @@ fn test_is_generic_email_new_domains() {assert!(is_generic_email("[email protected]"));}+#[test]+fn test_is_generic_email_expanded_keywords() {+ // "notification" anywhere in the local part, not just as a prefix+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));++ // Other strong keywords anywhere in the local part+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));++ // New automated prefixes+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+}++#[test]+fn test_is_generic_email_expanded_domains() {+ // ESP sending/bounce domains+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));++ // Product notification domains+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+ assert!(is_generic_email("[email protected]"));+}++#[test]+fn test_is_generic_email_expanded_false_positives_avoided() {+ // Real names that share letters with new prefixes+ assert!(!is_generic_email("[email protected]")); // "sales" not at start+ assert!(!is_generic_email("[email protected]")); // "report" followed by a letter+ assert!(!is_generic_email("[email protected]")); // "invite" followed by a letter+ assert!(!is_generic_email("[email protected]")); // "members" followed by a letter+ assert!(!is_generic_email("[email protected]"));+ assert!(!is_generic_email("[email protected]")); // "community" followed by a letter+ assert!(!is_generic_email("[email protected]")); // no "notification" substring+ // Corporate domains that host real humans stay non-generic+ assert!(!is_generic_email("[email protected]"));+ assert!(!is_generic_email("[email protected]"));+ assert!(!is_generic_email("[email protected]"));+}+#[test]fn test_is_generic_email_autogenerated_patterns() {// UUID patterns