It’s been nutso at work since I got back and I’ve been researching a new idea too. So, I’ve not had time for posting. But I will share with you some of what’s caught my attention.
I have two plug-ins I am working on. One is in the EARLY testing phase. It’s called No-More-404. It allows all of the permalink structures you used before to be handled and not present 404 errors. I would like it to present 301 (moved/redirect) messages and point you to the correct structure, but right now I haven’t found an elegant way of doing that. The plugin is toooo top heavy if I build in all of the routines I would need to use using the method I have right now. So, it looks like version 1 of the plugin will simply allow multiple permalink structures for the initial link to your site. Google frowns on that, but it is better than everyone getting 404 errors. After they click (or crawl)on another link, the new structure will be used. But it would be better if I could force it to the official structure.
I am also working on a DNSBL routine that may become a WP plugin or maybe a VB plugin as well. Basically it will block spams based up on the IP address used to send the message. It would be strange to have WP manage your spam, but as long as both VBulletin and WordPress have Cron ablities, it will work for someone that does not have shell access to their host.
But I ran across a technical problem yesterday and it vexed me. I think I have it solved though. Some of you may find this interesting so, I’ll provide part of the conversation I’ve had over at http://www.codingforums.com/showthread.php?t=89994. Besites I am soooo light on words lately…
PHP Imap_blah function to retrieve full Internet header
I’ll switch over to the pear library if need be, but I CANNOT believe the built in php functions don’t do what I want them to do.
I can use imap_header to get the basic "to" and "from" stuff in emails. They give the "typical end user" level of info about the origin of the email. However, what I want retrieve is the ip address of the smtp server that processed the email. That information is included in EVERY email and is available from IMAP servers (at least it is available to Outlook because you can right click on an email and choose options to see it).
I cannot find an IMAP_BLAHBLAHBLAH function that either returns this info or returns the full raw text of the message. I need the email’s Internet headers. This stuff:
Delivery-Date: Mon, 26 Jun 2006 23:53:47 -0400
Received-SPF: none (mxus6: 126.96.36.199 is neither permitted nor denied by domain of alushiptechnology.com) client-ip=188.8.131.52; firstname.lastname@example.org; helo=Laskowski6;
Received: from [184.108.40.206] (helo=Laskowski6)
by mx.perfora.net (node=mxus6) with ESMTP (Nemesis),
id 0MKvMg-1Fv4dv28vt-0006m9 for *@thecodecave.com; Mon, 26 Jun 2006 23:53:47 -0400
From: "Adam Field" <email@example.com>
Subject: RICARDO examined BENJAMIN of a please
Date: Tue, 27 Jun 2006 03:53:44 +0480
X-Mailer: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
But all I get from imap_headerinfo is this stuff :
stdClass Object ( [date] => Tue, 27 Jun 2006 03:53:44 +0480 [Date] => Tue, 27 Jun 2006 03:53:44 +0480 [subject] => RICARDO examined BENJAMIN of a please [Subject] => RICARDO examined BENJAMIN of a please [message_id] => <0MKvMg-1Fv4dv28vtfirstname.lastname@example.org> [toaddress] => [to] => Array (  => stdClass Object ( [personal] => [mailbox] => brian [host] => thecodecave.com ) ) [fromaddress] => "\"Adam Field\"" [from] => Array (  => stdClass Object ( [personal] => "Adam Field" [mailbox] => tkuhnel [host] => alushiptechnology.com ) ) [reply_toaddress] => "\"Adam Field\"" [reply_to] => Array (  => stdClass Object ( [personal] => "Adam Field" [mailbox] => tkuhnel [host] => alushiptechnology.com ) ) [senderaddress] => "\"Adam Field\"" [sender] => Array (  => stdClass Object ( [personal] => "Adam Field" [mailbox] => tkuhnel [host] => alushiptechnology.com ) ) [Recent] => [Unseen] => [Flagged] => [Answered] => [Deleted] => D [Draft] => [Msgno] => 1 [MailDate] => 27-Jun-2006 03:53:47 +0000 [Size] => 12651 [udate] => 1151380427 [fetchfrom] => "Adam Field" [fetchsubject] => RICARDO examined BENJAMIN of a please )
The imap_body requests provide no more info with the default parameters.
I suspect the quotes I’ve provided here are more info than is needed for anyone that knows the answer, but I wanted to be clear about what I was asking.
So, how do I get that Received-SPF or Recieved info?
If this is not possible, is PEAR my best bet or do I have to go old school on this thing and communicate with it via FTP or telnet?
Input is appreciated!
to find the SMTP address, would it not be as easy as extracting the hostname from the sender’s email address, and converting it to an IP address if necessary with gethostbyname() (http://us2.php.net/manual/en/function.gethostbyname.php)?
Unfortunately, it is rarely that simple.
Take for example that address on the spam I quoted earlier. email@example.com was used as the sender. However, that address is probably some innocent business man that had their email address plastered into several thousand spam emails.
Alushiptechnology.com evaluates to 220.127.116.11. That is very different from the address of the SMTP server that we see in the email 18.104.22.168. Additionally, since shared servers have become more common, it is not at all unusual for the SMTP server to be a common server – say smtp.lunarpages.com and the website url/email address to be on a totally different server like Support@codingforums.com.
So, unfurtunately, all things being equal, gethostbyname() is a good idea that won’t work in this situation. However, if we were to check on the IP address of the SMTP server, we can tell that it is blocked. Here is one of the places I would check: http://www.spamcop.net/w3m?action=ch…=22.214.171.124+
I’ll see if PEAR has a solution for me. But I still find it hard to believe that this info is not available from the built in functions that otherwise seem so robust!
If any of my readers have any other suggestions, your input would be much appreciated too!!!