khendar Posted August 8, 2008 Share Posted August 8, 2008 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/118713-rcpt-failing-in-script-works-in-telnet/ Share on other sites More sharing options...
btherl Posted August 8, 2008 Share Posted August 8, 2008 Could it be a newline issue? Can you run a sniffer to detect the exact traffic going over the network? If it gives a different response it must be getting different data from your script. Quote Link to comment https://forums.phpfreaks.com/topic/118713-rcpt-failing-in-script-works-in-telnet/#findComment-611306 Share on other sites More sharing options...
sKunKbad Posted August 8, 2008 Share Posted August 8, 2008 Why reinvent the wheel? Theres a link to a nice script on the php.net getmxrr() page that I've been using. Quote Link to comment https://forums.phpfreaks.com/topic/118713-rcpt-failing-in-script-works-in-telnet/#findComment-611337 Share on other sites More sharing options...
khendar Posted August 8, 2008 Author Share Posted August 8, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/118713-rcpt-failing-in-script-works-in-telnet/#findComment-611689 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.