From f186c2b37bd9bcdf5fe3ea8535bba5573e251203 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 6 Jul 2021 09:57:35 +0200 Subject: [PATCH] Allow matching domain names --- FAQ.md | 1 + .../main/java/eu/faircode/email/EntityIdentity.java | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/FAQ.md b/FAQ.md index d17d767da6..ec72f063de 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1440,6 +1440,7 @@ It is possible to configure a [regex](https://en.wikipedia.org/wiki/Regular_expr to match **the username** of an email address (the part before the @ sign). Note that the domain name (the parts after the @ sign) always needs to be equal to the domain name of the identity. +Since version 1.1640 it is possible to match the full email address with a regex, which can be useful for matching alias domain names. If you like to match a catch-all email address, this regex is mostly okay: diff --git a/app/src/main/java/eu/faircode/email/EntityIdentity.java b/app/src/main/java/eu/faircode/email/EntityIdentity.java index 6b9a57708c..1289458516 100644 --- a/app/src/main/java/eu/faircode/email/EntityIdentity.java +++ b/app/src/main/java/eu/faircode/email/EntityIdentity.java @@ -157,12 +157,12 @@ public class EntityIdentity { if (cother.length != 2 || cemail.length != 2) return false; - // Domain - if (!cother[1].equalsIgnoreCase(cemail[1])) - return false; - - // User if (TextUtils.isEmpty(sender_extra_regex)) { + // Domain + if (!cother[1].equalsIgnoreCase(cemail[1])) + return false; + + // User int plus = cother[0].indexOf('+'); String user = (plus < 0 ? cother[0] : cother[0].substring(0, plus)); if (user.equalsIgnoreCase(cemail[0]))