# Email domain blacklist with wildcards

**URL:** https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627
**Category:** Support
**Created:** [Maio 11, 2015, 12:54pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627 "2015-05-11T12:54:32Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Alex\_Harrington](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_harrington/32/249857_2.png) [@Alex\_Harrington](https://meta.discourse.org/u/Alex_Harrington)
#### Post date: [Maio 11, 2015, 12:54pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/1 "2015-05-11T12:54:32Z")

</div>

Hi

I’m trying to block email addresses from a particular domain - from which we seem to receive multiple spam user accounts per hour sigining up.

They come from .jil.kr where can be one of some 20 or so names I’ve seen so far.

I tried adding jil.kr but that doesn’t match, so then tried \*.jil.kr instead but that gives an error in the log that the regex is invalid as there’s no subject for the \* character, so I then tried (.\*).jil.kr and that doesn’t match either - I think because the . character in the brackets is being escaped.

Is it possible to add an entry for \*.jil.kr?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Maio 11, 2015, 11:28pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/3 "2015-05-11T23:28:57Z")

</div>

> [@Alex\_Harrington](#):
>
> Is it possible to add an entry for \*.jil.kr?

Yes, simply add `jil.kr` as I believe it enforces for all subdomains.

---

<div class="post-metadata">

### Author: ![Alex\_Harrington](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_harrington/32/249857_2.png) [@Alex\_Harrington](https://meta.discourse.org/u/Alex_Harrington)
#### Post date: [Maio 12, 2015, 6:51am UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/4 "2015-05-12T06:51:33Z")

</div>

> [@codinghorror](#):
>
> Yes, simply add jil.kr as I believe it enforces for all subdomains.

I did already try that, but I’ve put it back in and will see today if we get another signup from a subdomain of that.

Thanks

Alex

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Maio 12, 2015, 6:58am UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/5 "2015-05-12T06:58:23Z")

</div>

Ok, let me know if it does not work. It should, if not we will make it work!

---

<div class="post-metadata">

### Author: ![Alex\_Harrington](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alex_harrington/32/249857_2.png) [@Alex\_Harrington](https://meta.discourse.org/u/Alex_Harrington)
#### Post date: [Maio 12, 2015, 11:33am UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/6 "2015-05-12T11:33:40Z")

</div>

So with `jil.kr` in the email domain blacklist, we just had a signup from `vil7421@stock.jil.kr` so it doesn’t appear to work at present.

Also just now another from `fdzr2860@bank.jil.kr`

and another from `prvhu5960@site.jil.kr`

Sorry!

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [Maio 12, 2015, 8:02pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/7 "2015-05-12T20:02:06Z")

</div>

It must be considering everything after the @ to be the domain as opposed to “ends with”  
Depending on how many variations are possible you’ll be playing whack-a-mole without some form of regex here.

---

<div class="post-metadata">

### Author: ![kensims](https://avatars.discourse-cdn.com/v4/letter/k/97f17d/32.png) [@kensims](https://meta.discourse.org/u/kensims)
#### Post date: [Maio 12, 2015, 8:43pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/8 "2015-05-12T20:43:59Z")

</div>

> [@Mittineague](#):
>
> Depending on how many variations are possible you’ll be playing whack-a-mole without some form of regex here.

How about in addition to an exact match, if the end matches and the email address has a period immediately preceding the specified domain, that’s also a match.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [Maio 12, 2015, 9:48pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/9 "2015-05-12T21:48:33Z")

</div>

@techapj please make it so that this does a simple exact match, and then a ‘period ends with’ match on the string.

So if someone enters

`jil.kr`

in the email domain blacklist it will match all these:

`foo.jil.kr`  
`bar.jil.kr`  
`jil.kr`

but it should _not_ match

`mejil.kr`

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [Maio 13, 2015, 12:21pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/10 "2015-05-13T12:21:37Z")

</div>

Okay, made it so:

[https://github.com/discourse/discourse/pull/3463](https://github.com/discourse/discourse/pull/3463)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [Maio 13, 2015, 4:03pm UTC](https://meta.discourse.org/t/email-domain-blacklist-with-wildcards/28627/11 "2015-05-13T16:03:12Z")

</div>


