Skip to content

Commit

Permalink
adding the support of disposable addresses, now they are detected as …
Browse files Browse the repository at this point in the history
…free

aka non-business
  • Loading branch information
salaros committed May 28, 2019
1 parent 1463034 commit b237d6b
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 3 deletions.
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,25 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.




Copyright (c) 2013 Matthieu Moquet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ download: prepare
@grep -Ei 'freemail_domains (.*)$$' $(DOMAINS_LIST).tmp | grep -oP 'freemail_domains \K.*' > $(DOMAINS_LIST) && rm $(DOMAINS_LIST).tmp
@cat $(DOMAINS_LIST_PLUS) >> $(DOMAINS_LIST) # Append the list of domains not found in SpamAssassin to the rest
@sed -E -e 's/[[:blank:]]+/\n/g' -i $(DOMAINS_LIST) # Replace all spaces with new lines
@wget -q https://raw.githubusercontent.com/MattKetmo/EmailChecker/master/res/throwaway_domains.txt -O ->> $(DOMAINS_LIST)
@grep "*" $(DOMAINS_LIST) > $(DOMAINS_LIST).wildcard # Move all wildcard patterns to a separate file
@sed "/*/d" -i $(DOMAINS_LIST) # Remove wildcard patterns from the list of domains
@sed "/*/d" $(DOMAINS_LIST) > $(DOMAINS_LIST).tmp # Remove wildcard patterns from the list of domains
@awk '!seen[$$0]++' $(DOMAINS_LIST).tmp | sort > $(DOMAINS_LIST)
@sed '$$!{:a;N;s/\n/ /;ta}' -i $(DOMAINS_LIST)* # replace all new lines with a single whitespace
@sed 's/ /\n/6;P;D' -i $(DOMAINS_LIST)* # Split a single line in multiple rows each containing maximum 6 domains
@sed -e ':a' -e 'N' -e '$$!ba' -e 's/\n/",\n"/g' -i $(DOMAINS_LIST)*
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ deploy:

- provider: NuGet
api_key:
secure: TrtChQUTQ9rD8pffK1A9bjMYyN/8eQUjV+7IKVjS/C37TgXMae46Bzd527bZUVSb
secure: i6oWn60J7ZOM4UuYcvxbuk9OAEp6or+Wq7izyJDPNlcLIhG2UKsxz7G/8erhdY3M
artifact: NuGet_Files
server: # remove to push to NuGet.org
skip_symbols: false
Expand Down
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 1 files
+14 −0 email-test-samples.json
9 changes: 9 additions & 0 deletions tests/EmailSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ internal class EmailSamples
[JsonProperty("pattern")]
public List<string> DomainPatterns { get; internal set; }

/// <summary>
/// Gets or sets the list of disposable email addresses.
/// </summary>
/// <value>
/// The list of disposable email addresses.
/// </value>
[JsonProperty("disposable")]
public List<string> Disposable { get; internal set; }

/// <summary>
/// Gets or sets the list of invalid emails.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions tests/IsBizMailTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public void AreFreeConsideredFree()
}
}

[Fact]
public void AreDisposableConsideredFree()
{
Assert.NotNull(EmailSamples.Disposable);
Assert.NotEmpty(EmailSamples.Disposable);

foreach (var disposableEmail in EmailSamples.Disposable)
{
Assert.True(IsBizMail.IsFreeMailAddress(disposableEmail), $"{disposableEmail} is disposable");
}
}

[Fact]
public void DoPatternsWork()
{
Expand Down

0 comments on commit b237d6b

Please sign in to comment.