Jump to content

RCPT failing in script - Works in Telnet


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(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"); 
    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
Share on other sites

I didn't write the script, I just have to get it working.


There's no way to sniff the data on the network.


I've tried all variations on the newline/return characters but they all either return the same error or don't run at all.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.