Chilkat .NET BlackList Class Reference (C#)

Chilkat.BlackList

BlackList provides the ability to instantly determine if an email contains a domain name contained in a blacklist. The blacklist can be very large, and lists of over 1 million domain names are easily handled with instant lookup times. Chilkat BlackList also un-obfuscates both HTML and plain-text email bodies and quickly parses out domain names from all parts of the email to check against a blacklist. Chilkat BlackList can undo every obfuscation trick known to spammers, and uncovers the domain names in a canonicalized form for easy recognition.

Important Notes

Domains are stored in the blacklist in canonicalized form. "Canonicalized" means that all domain names are first converted to a standard form before being entered into the list. The conversion rules are as follows:

  1. Domain names ending in .com, .org, .net, .edu, or any non-country specific suffix that is not two characters long are shortened to two parts. For example, "mail.yahoo.com" becomes "yahoo.com". This is necessary because spammers can create ever-changing prefixes that map to the same domain. For example: blahblahblah.everydayemailpromotions.com

  2. Domain names ending in 2-letter country codes are shorted to the last three parts.
    For example, "perl-seiten.bei.t-online.de" is shortened to "bei.t-online.de".

Reference Index
Chilkat Home
Example Programs

Properties

BanDotBiz
BanDotInfo
Count
LastErrorHtml
LastErrorText
LastErrorXml

Methods

AddDomains
ContainsBlackListedDomain
Convert
DomainToIpAddress
Export
ExtractDomains
ExtractEmailDomains
ExtractEmailIpAddresses
GetDomain
IsBlackListed
IsEmailBlackListed
Load
RemoveDomains
Save
SaveLastError
UnlockComponent

Properties

public bool BanDotBiz {get; set; }

When set to True, causes all .biz domain names to be blacklisted.

public bool BanDotInfo {get; set; }

When set to True, causes all .info domain names to be blacklisted.

public int Count {get; }

The number of domain names in the blacklist.

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

Error information in plain-text format for the last method called.

public string LastErrorXml {get; }

Error information in XML format for the last method called.

Methods

public bool AddDomains(string domains);

Adds 1 or more domains to the blacklist. The domain names in the input string should be separated by whitespace ( space, tab, or CRLF characters ) and not commas.

public bool ContainsBlackListedDomain(string cText);

Searches the content and determines if any domain contained in the blacklist is present in the content.

Returns true if the domain is present in the content, otherwise returns false.

public bool Convert(string filename, string outFilename);

Converts a text file containing one domain-name per line to a Chilkat BlackList format file. This is a binary file that contains the list of domain names (canonicalized with no duplicates) and in pre-sorted order with lookup indexes. The output file of this method is what should be loaded with the Load method. Failure means that the input file could not be found or read, or that the output file could not be created.

Returns true for success, false for failure.

public string DomainToIpAddress(string domain);

Utility function to convert a domain to an IP address.

public bool Export(string outFilename);

Exports the blacklist to a text file containing one domain name per line.

Returns true for success, false for failure.

public bool ExtractDomains(string cText, StringArray sa);

Finds all the domains present in the content and returns a CkStringArray object containing the domain names (all lowercase and no duplicates).
*CkStringArray is a free component and is included in the ChilkatUtil DLL that is part of the BlackList download.

Returns true for success, false for failure.

public bool ExtractEmailDomains(Email email, StringArray sa);

Finds all the domains present in any part of an email and returns a CkStringArray object containing the domain names (all lowercase and no duplicates). This feature can only be used if the Chilkat Mail component is downloaded and installed, and it also requires Chilkat Mail to be licensed in addition to Chilkat BlackList.*CkStringArray is a free component and is included in the ChilkatUtil DLL that is part of the BlackList download.

public bool ExtractEmailIpAddresses(Email email, StringArray sa);

Same as ExtractEmailDomains, except the IP addresses are returned.

public string GetDomain(int index);

Returns the Nth domain in the blacklist. Indexing begins at 0, and the number of domains in the blacklist is found in the Count property.

public bool IsBlackListed(string domain);

Takes a domain name, whether in standard form or not, and tells whether it is in the blacklist or not.

A value of true is returned if the domain is in the blacklist, false is returned if not in the blacklist.

public bool IsEmailBlackListed(Email email);

Takes an email object and tells whether it contains a blacklisted domain in any of it's header or body parts, HTML included.
This feature can only be used if Chilkat Mail is downloaded and installed, and it also requires Chilkat Mail to be licensed in addition to Chilkat BlackList.

A value of true is returned if a blacklisted domain is found, false if not.

public bool Load(string filename);

Loads a blacklist from a Chilkat Blacklist formatted binary file. This file can be created by either the Save method or the Convert method.

Returns true for success, false for failure.

public bool RemoveDomains(string domains);

Removes 1 or more domains from the blacklist. Domain names should be separated by whitespace ( space, tab, or CRLF characters) and not commas.

Returns true for success, false for failure.

public bool Save(string filename);

Saves the blacklist to a Chilkat Blacklist formatted (binary) file. This is a specially formatted structured file that stores the blacklist with pre-computed lookup indexes. The contents of the saved file can be accessed using the Export method. The blacklist object can be re-populated by calling Load.

Returns true for success, false for failure.

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.

public bool UnlockComponent(string unlockCode);

Unlocks the component. This must be called once at the beginning of your program to unlock the component. A permanent unlock code is provided when the BlackList component is licensed. A 30-day trial code can be obtained by registering at http://www.chilkatsoft.com/register30.asp

Copyright 2000-2006 Chilkat Software, Inc.