Git Product home page Git Product logo

ap.esp.json's Introduction

Synopsis

The ap.esp.json project is a json-based file that uses Regular Expressions to identify the sending range of a given ESP. The range values can be ascertained from the whois database (http://www.whois.com/whois/74.112.65.204).

Each ESP has its own block of sending IP addresses and each IP Address can be collected from the headers of an email message and can be translated into a regular expression which can Identify the ESP associated with the IP Address.

The Regex for the IP Range can be identified through online tools like this:

http://www.analyticsmarket.com/freetools/ipregex

Code Example

The ap.esp.json file can be used to identify the sending ESP with the following snippets of code:

Javascript

$.getJSON("http://<yourserver>.com/ap.esp.min.json", function(data){

    for( var ipMatch in data )
    {   
        reg = new RegExp(data[ipMatch].re);
        if(reg.test(ipAddress))
        {
        	console.log( data[ipMatch].Name );
        }
    }
}

PHP

//get the contents of the IP regex file	
$jsonData= file_get_contents("http://<yourserver>/ap.esp.min.json");
$phpArray = json_decode($jsonData, true);

$matches = array();

$ip = "123.123.123.123";
			
foreach ($phpArray as $ESPName => $ESPObject) //loop through records of array ( JSON )
{ 
	if (preg_match( "/".$ESPObject["re"]."/", $ip, $matches ) == $SUCCESS )
	{
		return $ESPName;
	}   
}

Motivation

AudiencePoint, as a marketing AND a technology company wants to reinvest in the industry by sharing building blocks that creates greater industry value.

Adding a node to this project

Additional nodes can be added alphabetically to ap.esp.json by adding this node:

	"MailItAnyway": 
		{"re": "^216\\.27\\.([0-9]|[1-8][0-9]|9[0-5])\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$", 
		"names": "Mail It Anyway",
		"image": "myMail.png"},	

Please remember to add the image of the ESP to the images directory of GitHub and to minify and validate the changes to the file before you commit to the GitHub Repository.

http://www.cleancss.com/json-minify/

The image size should be 128px to 512px.

NOTE: The regular expressions are being stored as a string, so backslashes (\) will need to be escaped (\\) .

"^216\\.27\\.([0-9]|[1-8][0-9]|9[0-5])\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$"

Contributors

  • Kurt Weisheit
  • Gbemi Ojo

License

ap.esp.json is licensed under the MIT License

ap.esp.json's People

Contributors

shrinerp avatar

Watchers

Kurt Weisheit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.