Google Answers Logo
View Question
 
Q: Matching Sending MTA in PHP ( No Answer,   0 Comments )
Question  
Subject: Matching Sending MTA in PHP
Category: Computers > Programming
Asked by: matth-ga
List Price: $5.50
Posted: 07 Apr 2004 11:13 PDT
Expires: 07 May 2004 11:13 PDT
Question ID: 326692
Hi,
I'm trying to match the sending mail server in mail headers and parse
it into a variable.   I'm using PHP.    The problem I'm running into
is that there seems to be no standard for headers.
Basically the line looks like:
Received: from unknown (HELO Alyon-112-2-3-4.someisp.com)
(63.174.243.2) by mail.receivingisp.com with SMTP;

The issue I have is parsing out that IP address... I'm currently using
regular expressions.

Also, it seems there is no standard so sometimes the header will be:
(x.x.x.x) other times [x.x.x.x] other time ([x.x.x.x]).
So.. I could parse for just an IP... however... spammers seem to like
to forge the HELO header often with the receiving mail server!!!  This
results in MY mailserver getting added to my blacklist.

EXAMPLE:
Received: (qmail 12181 invoked from network); 6 Apr 2004 14:12:27 -0000
Received: from unknown (HELO 63.174.254.3) (207.36.226.195)
  by mail.homegrownhost.net with SMTP; 6 Apr 2004 14:12:27 -0000
Date: Tue, 06 Apr 2004 10:11:04 -0500 
Message-Id: <10604-47326-86@luckydeals6.com> 
From: "4 Phones" 
To: 
Subject: Complimentary Cell Phone Upgrade

That 63.174.254.3 is forged into the headers, but matching only for an
IP on the receive line will cause 63.174.254.3 to be grabbed instead
of the 207 address.

Basically, I need a way to solidly identify the IP without
accidentally identifying false IPs.

How can I do this in PHP?
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy