I'm trying to create a mail testing function, to avoid bounces when mailing.
Since I have to check a lot of email addresses, I need to use proxy in order to avoid google ban server IP.
I'm not sure if I can do this, but is it possible to do this with proxies?
$toemail = 'mail to test';
$fromemail = 'mail from';
$connect = @fsockopen($mx_ip, 25);
// $mx_ip = aspmx2.googlemail.com
if($connect){
if(preg_match("/^220/i", $out = fgets($connect, 1024))){
fputs ($connect , "HELO $mx_ip\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);
if(!preg_match("/^250/i", $from) || !preg_match("/^250/i", $to)){
$result = "invalid";
}
else{
$result = "valid";
}
}
}
else{
$result = "invalid";
$details .= "Could not connect to server";
}
Thanks in advance.
If you are concerned that Google [or whichever service ] will ban due to over use your main server, then the same service could ban the Proxy as well. So I don't think using proxy server will resolve your issue.
I think you should consider a paid service, which will not ban you in the first place.