<commit_before><?php
print_r(verifyEmail('<EMAIL>', '<EMAIL>', true));

function verifyEmail($toemail, $fromemail, $getdetails = false){
	$email_arr = explode("@", $toemail);
	$domain = $email_arr[1];
	getmxrr($domain, $mxhosts, $mxweight);
	$mx = $mxhosts[array_search(min($mxweight), $mxhosts)];
	
	$connect = @fsockopen($mx, 25); 
	if($connect){ 
		if(ereg("^220", $out = fgets($connect, 1024))){ 
			fputs ($connect , "HELO $HTTP_HOST\r\n"); 
			$out = fgets ($connect, 1024);
			$details .= $out."\n";
 
			fputs ($connect , "MAIL FROM: <$fromemail>\r\n"); 
			$from = fgets ($connect, 1024); 
			$details .= $from."\n";

			fputs ($connect , "RCPT TO: <$toemail>\r\n"); 
			$to = fgets ($connect, 1024);
			$details .= $to."\n";

			fputs ($connect , "QUIT"); 
			fclose($connect);
<commit_msg>Enabled IP format email addresses and A-record checks.<commit_after><?php
print_r(verifyEmail('<EMAIL>', '<EMAIL>', true));

function verifyEmail($toemail, $fromemail, $getdetails = false){
	$email_arr = explode("@", $toemail);
	$domain = array_slice($email_arr, -1);
	$domain = $domain[0];

	// Trim [ and ] from beginning and end of domain string, respectively
	$domain = ltrim($domain, "[");
	$domain = rtrim($domain, "]");

	$mxhosts = array();
	if( filter_var($domain, FILTER_VALIDATE_IP) )
		$mx_ip = $domain;
	else
		getmxrr($domain, $mxhosts, $mxweight);

	if(!empty($mxhosts) )
		$mx_ip = $mxhosts[array_search(min($mxweight), $mxhosts)];
	else {
		$record_a = dns_get_record($domain, DNS_A);
		$mx_ip = $record_a['ip'];
	}
	
	$connect = @fsockopen($mx, 25); 
	if($connect){ 
		if(ereg("^220", $out = fgets($connect, 1024))){ 
			fputs ($connect , "HELO $HTTP_HOST\r\n"); 
			$out = fgets ($connect, 1024);
			$details .= $out."\n";
 
			fputs ($connect , "MAIL FROM: <$fromemail>\r\n"); 
			$from = fgets ($connect, 1024); 
			$details .= $from."\n";

			fputs ($connect , "RCPT TO: <$toemail>\r\n"); 
			$to = fgets ($connect, 1024);
			$details .= $to."\n";

			fputs ($connect , "QUIT"); 
			fclose($connect);

{'fraction_non_alphanumeric': 0.22194760257043994, 'fraction_numerical': 0.022244191794364803, 'mean_word_length': 4.270833333333333, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '42485', 'n_tokens_mistral': 899, 'n_tokens_neox': 788, 'n_words': 167}