Coder Social home page Coder Social logo

lici0 / php---json-email-verification Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dukeofmarshall/php---json-email-verification

0.0 2.0 0.0 216 KB

This is a short, simple, and straight forward script to perform some basic verification on a submitted email address. Can be used either as a PHP include/require or as a straight up URL with one GET variable so that one can use it with just about any other language such as JavaScript, etc

License: GNU General Public License v3.0

PHP 100.00%

php---json-email-verification's Introduction

Donate

PayPal donate button

PHP---JSON-Email-Verification

This is a short, simple, and straight forward script to perform some basic verification on a submitted email address. Can be used either as a PHP include/require or as a straight up URL with one GET variable so that one can use it with just about any other language such as JavaScript, etc. When calling through a URL with another language such as JavaScript, the output is returned as a JSON string.

{"format_verified":1,"error":0,"domain_verified":1,"message":"Formatting and domain have been verified"}
["format_verified"] => 1 (BOOL)
["error"] => 0 (BOOL)
["domain_verified"] => 1 (BOOL)
["message"] => "Formatting and domain have been verified" (STRING)

This has only been developed and tested on a CentOS Apache setup with PHP 5.4.21 .

githalytics.com alpha

Options

Option Type Notes
address_to_verify STRING The email address that you are wanting to verify
verbose BOOL Return more detailed error messages

PHP Methods

Method Passed Options Return Purpose
verify_domain() $address_to_verify TRUE if MX record has been verified. FALSE otherwise Verify that an MX record exists for the domain name in the email address passed to the method
verify_formatting() $address_to_verify, $verbose TRUE if email address is formatted as it should. If the address is not formatted correctly, then the address will return FALSE if $verbose is not set or a STRING message if $verbose IS set. Verify that the email address passed to the method is formatted correctly
convert_html_to_plain_txt() $content, $remove_links The plain text of the HTML code that was submitted To take the HTML code submitted and remove all the HTML code sections out of the block. If $remove_links is set to TRUE, then the address from < a > links will be gone. FALSE is the default for $remove_links and will instead leave the address from < a > links in the returned plain text string.

JavaScript Example:

Using jQuery:

$(function(){
	$("#js_verify").click(function(){
		$.getJSON("EmailVerify.class.php", { "address_to_verify" : $("#email").val() }, function(data){
			alert(data.message);
			return false;
		});
		return false;
	});
});

PHP Example:

require_once("EmailVerify.class.php");
$verify = new EmailVerify();

if($verify->verify_formatting($_POST['email'])){
	echo "Email is formated correctly<BR>\r\n";
}else{
	echo "Email is NOT formated correctly<BR>\r\n";
}

if($verify->verify_domain($_POST['email'])){
	echo "Domain has been verified<BR>\r\n";
}else{
	echo "Domain has NOT been verified<BR>\r\n";
}

$plain_text = $verify->convert_html_to_plain_txt($html_email_content_to_convert);

php---json-email-verification's People

Contributors

dukeofmarshall avatar

Watchers

James Cloos avatar  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.