>> We would still want [email protected] to be available, but having an  
>> additional form on the site would probably be a good thing.

So, this morning I was finally able to come up for air, and whipped up  
this script. It's not perfect, but I think it works for now (it's not  
yet MIME-aware). Basically, we just need [email protected] to  
pipe mail to (an altered version of (at least the addresses need  
changing)) this script.

Thoughts?

S

===

#!/usr/local/bin/php
<?php

$input = str_replace("\r", '', file_get_contents('php://stdin'));
list($headers, $body) = explode("\n\n", $input, 2);

if (!$headers || !$body) {
     die();
}

$key = null;
$from = '';
$subject = '[SECURITY] ';
foreach (explode("\n", $headers) as $header) {
     if (strpos($header, ':') !== false) {
         list($key, $val) = explode(': ', $header, 2);
     } else {
         $val = $header;
     }
     switch (strtolower($key)) {
         case 'from':
             $from .= $val;
             break;
         case 'subject':
             $subject .= $val;
             break;
         default:
             // ignore
     }
}

if (ctype_print($from) && ctype_print($subject)) {
     $body .= "\nOriginal headers:\n" . print_r($headers, true);
     $mailHeaders = "From: [email protected]\ncc: " .  
$from;
     mail('[email protected]',$subject,$body, $mailHeaders);
}


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to