Jump to content

RCPT failing in script - Works in Telnet


khendar

Recommended Posts

I've got a script which does email verification by connecting to the domain's mx server. The script in a nutshell:

 

 

$connect = @fsockopen($connectaddress, 25) 
if($connect){ 
  if(ereg("^220, $out = fgets($connect, 1024))){ 
    fputs ($connect , "HELO $HTTP_HOST\r\n"); 
    $out = fgets ($connect, 1024); 
    fputs ($connect , "MAIL FROM: $fromemail\r\n"); 
    $from = fgets ($connect, 1024); 
    fputs ($connect , "RCPT TO: $toemail\r\n"); 
    $to = fgets ($connect, 1024); 
    fputs ($connect , "QUIT"); 
    fclose($connect); 
    if(!ereg("^250", $from) || !ereg("^250", $to)) 
      return "The email address does not exist"; 
  } 
}

 

 

 

So basically, I open a socket, sent a HELO, then send MAIL FROM and RCPT TO and capture the returns, which I check for code 250 (OK). If it does not return OK then the address is deemed invalid.

 

The problem is that I'm finding its rejecting valid email addresses. The RCPT TO call is returning 550 - Blocked on email addresses that I know are valid. If I perform the same procedure via telnet, I get 220 returning from the RCPT call.

 

Any ideas ?

 

Link to comment
https://forums.phpfreaks.com/topic/118713-rcpt-failing-in-script-works-in-telnet/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.