[kronolith] [patch] Kronolith's Received: line

Kaj J. Niemi mail.sw.horde.kronolith@spam.fi.basen.net
Sat, 31 Aug 2002 19:35:14 +0300


---------------------- multipart/mixed attachment
Hi,


Diff to latest CVS HEAD attached. Cosmetic fix, looks now more 
fashionable. Took most of it from IMP. One could add envelope-from
to IMP's lib/Header.php as well?

Was:

Received: from hanna.a51.org ( [hanna.a51.org])
         by mymail.fi.basen.net with HTTP;
        Sat, 31 Aug 2002 19:22:14 +0300

Now: 

Received: from hanna.a51.org (hanna.a51.org [212.226.212.57]) 
        by mymail.fi.basen.net (kronolith 2.0-cvs) with HTTP;
        Sat, 31 Aug 2002 19:28:27 +0300
        (envelope-from kajtzu@fi.basen.net)



// kaj ;-)

---------------------- multipart/mixed attachment
--- invite.php.virgin	Sat Aug 31 18:57:43 2002
+++ invite.php	Sat Aug 31 19:28:59 2002
@@ -43,14 +43,25 @@
          $from = MIME::rfc822WriteAddress($mailbox, $host, $ident->getValue('fullname'));
 
          /* Add a Received header for the hop from browser to server. */
-         $remote = (!empty($_SERVER['REMOTE_HOST'])) ? $_SERVER['REMOTE_HOST'] : $_SERVER['REMOTE_ADDR'];
+
+         if (empty($_SERVER['REMOTE_HOST'])) {
+             $remote = gethostbyaddr($_SERVER['REMOTE_ADDR']);
+         } else {
+             $remote = $_SERVER['REMOTE_HOST'];
+         }
+
          $headers['Received'] = 'from ' . $remote . ' (';
+
          if (!empty($_SERVER['REMOTE_IDENT'])) {
-             $headers['Received'] .= $_SERVER['REMOTE_IDENT'] . '@' . $remote;
-         }
-         $headers['Received'] .= ' [' . $remote . '])';
-         $headers['Received'] .= "\n\t by " . $conf['server']['name'] . ' with HTTP;';
-         $headers['Received'] .= "\n\t" . date('r');
+             $headers['Received'] .= $_SERVER['REMOTE_IDENT'] . '@' . $remote . ' ';
+         } elseif ($remote != $_SERVER['REMOTE_ADDR']) {
+	     $headers['Received'] .= $remote . ' ';
+	 }
+
+         $headers['Received'] .= '[' . $_SERVER['REMOTE_ADDR'] . '])' . " \n\t";
+         $headers['Received'] .= "by " . $conf['server']['name'] . " (kronolith " . KRONOLITH_VERSION . ") with HTTP;\n\t";
+         $headers['Received'] .= date('r') . "\n\t";
+         $headers['Received'] .= "(envelope-from " . $email . ")";
 
          $headers['Message-ID'] = '<' . uniqid(time() . '.') . '@' . $conf['server']['name'] . '>';
          $headers['Date'] = date('r');

---------------------- multipart/mixed attachment--