|
FastMail Forum All posts relating to FastMail.FM should go here: suggestions, comments, requests for help, complaints, technical issues etc. |
|
Thread Tools |
6 Nov 2022, 11:56 AM | #1 |
Junior Member
Join Date: Nov 2022
Posts: 4
|
Sieve question: using regex to filter catch all address.
Every time when I create a (pseudo) "random" address to use catch-all, I want to create it when a certain rule that I can use regex sieve filter later.
For example, my email address is 785abc@testdomain.com, and the rule for this email address is last digit = (1st digit + 2nd digit)%10. 5 = (7+8)%10 If I always use this rule to create aliases, I can then use a sieve filter to reject all email addresses that don't follow this rule. My question is how can I utilize regex and sieve to create a filter like this? Last edited by unusable1281 : 7 Nov 2022 at 01:25 AM. |
6 Nov 2022, 04:11 PM | #2 |
The "e" in e-mail
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,090
|
How is your requirement different from saying that you want to look for a single numeric digit rather than 2 numeric digits in your match? I am puzzled, not really understanding what you are trying to achieve. Perhaps, an example original address and 'random alias' address might help to clarify.
|
7 Nov 2022, 02:16 AM | #3 | |
Junior Member
Join Date: Nov 2022
Posts: 4
|
Quote:
last digit = (1st digit + 2nd digit)%10. abc123@testdomain.com, PASS, 1+2=3, and the last digit is 3. abc124@testdomain.com, FAIL, 1+2=3, but the last digit is 4. abc678@testdomain.com, FAIL, (6+7)%10=3, but the last digit is 8. abc673@testdomain.com, PASS, (6+7)%10=3, and the last digit is 3. If someone sends me an email that doesn't follow the rule I created, it should be spam, and it can be rejected automatically using this rule. Also, anyone can use this idea to generate their own rule. For example, they might have more digits, or they may want to use +-*/ or whatever they want. But, the problem is I have no idea how to create this rule or is it possible to create a rule like this. |
|
7 Nov 2022, 02:56 AM | #4 |
The "e" in e-mail
Join Date: May 2003
Location: mostly in Thailand
Posts: 3,090
|
I think the only way of achieving this with normal regular expressions will be by use of alternatives, something like
Code:
abc( (00|19|28|37|46|55|64|73|82|91)0 | (01|10|29|38|47|56|65|74|83|92)1 | (02|11|20|39|48|57|66|75|84|93)2 [ (03|12|21|30|49|58|67|76|85|94)3 | (04|13|22|31|40|59|68|77|86|95)4 | (05|14|23|32|41|50|69|78|87|96)5 | (06|15|24|33|42|51|60|79|88|97)6 | (07|16|25|34|43|52|61|70|89|98)7 | (08|17|26|35|44|53|62|71|80|99)8 | (09|18|27|36|45|54|63|72|81|90)9 )@testdomain.com Some special regular expression extensions would probably allow a less ugly solution, but sieve is not going to support those. |
7 Nov 2022, 03:54 AM | #5 |
Junior Member
Join Date: Nov 2022
Posts: 4
|
Thanks for your answer. It seems like this is a too-advanced requirement that cannot be resolved.
|
7 Nov 2022, 07:53 AM | #6 |
Essential Contributor
Join Date: Jan 2017
Posts: 278
|
I used to use fixed format subdomain addresses that used a combination of a mnemonic and the year and month e.g. for this site I might have used emd2211@... My sieve script did check that it was the right format with exactly 4 digits matching sensible valid dates, but I never saw any attempt by spammers to make-up similar addresses. I don't think it's much of a problem. Using a subdomain may help to make it clear that there's no point in making-up addresses.
The reason I included the year+month is to prevent me from reusing an address, but for a 10 year window it gives a 1% risk of an accidental match on an address ending in 4 random digits compared with 10% for the modulo 10 test. |
7 Nov 2022, 09:53 AM | #7 | |
Junior Member
Join Date: Nov 2022
Posts: 4
|
Quote:
Also, do you mind sharing how to use a sieve to build the filter you mentioned? Last edited by unusable1281 : 7 Nov 2022 at 01:27 PM. |
|
Thread Tools | |
|
|