Files
Testing/mailservices/bateworld/smtp_validate_bak.php
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

123 lines
2.3 KiB
PHP

<?php header('Content-type: application/json');
require_once('smtp_validate.class.php');
// the email to validate
$email = 'porembaphilip@gmail.com';
if(isset($_GET["emailaddress"]))
{
$email=$_GET["emailaddress"];
}
else
{
exit();
}
exit();
// an optional sender
//$sender = 'user@mydomain.com';
// instantiate the class
$SMTP_Validator = new SMTP_validateEmail();
// turn on debugging if you want to view the SMTP transaction
$SMTP_Validator->debug = false;
// do the validation
$results = $SMTP_Validator->validate(array($email), $sender);
// view results
//echo $email.' is '.($results[$email] ? 'valid' : 'invalid')."\n";
// send email?
if ($results[$email]) {
echo "cool";
//mail($email, 'Confirm Email', 'Please reply to this email to confirm', 'From:'.$sender."\r\n"); // send email
} else {
echo 'The email addresses you entered is not valid';
}
exit();
//Validating Multiple Email addresses:
// include SMTP Email Validation Class
require_once('smtp_validateEmail.class.php');
// the email to validate
$emails = array('user@example.com', 'user2@example.com');
// an optional sender
$sender = 'user@yourdomain.com';
// instantiate the class
$SMTP_Validator = new SMTP_validateEmail();
// turn on debugging if you want to view the SMTP transaction
$SMTP_Validator->debug = true;
// do the validation
$results = $SMTP_Validator->validate($emails, $sender);
// view results
foreach($results as $email=>$result) {
// send email?
if ($result) {
//mail($email, 'Confirm Email', 'Please reply to this email to confirm', 'From:'.$sender."\r\n"); // send email
} else {
echo 'The email address '. $email.' is not valid';
}
}
exit();
$email = 'porembaphilip@gmail.com';
echo $email;
list($user, $domain) = explode('@', $email);
$port = 25; // default smtp port
$sock = fsockopen($domain, $port);
if ($sock) {
fputs($sock, 'HELO b8world.com');
$reply = fgets($sock); // not interesting
fputs($sock, 'MAIL FROM: user@mydomain.com');
$reply = fgets($sock); // not interesting
fputs($sock, 'RCPT TO: '.$email);
$reply = fgets($sock); // interesting
list($code, $msg) = explode(' ', $reply);
if ($code == '250') {
echo "cool"; // you received 250 so the email address is accepted
} else {
echo "not cool";
// something went wrong, the email will most likely bounce
}
fclose($sock);
}
echo $email;
exit();
?>