<?php
$user=getenv(REMOTE_USER);
if (getenv(HTTP_X_FORWARDED_FOR))
{ $ip=getenv(HTTP_X_FORWARDED_FOR);
}
else{ $ip=getenv(REMOTE_ADDR); }
$date_time = date("l jS \of F Y H:i:s T", $_SERVER['REQUEST_TIME'] );
// the obvious one doesn't work! $request_time = apache_getenv(REQUEST_TIME);
$request_method = getenv(REQUEST_METHOD);
$request_uri = getenv(REQUEST_URI);
$user_agent = getenv(HTTP_USER_AGENT);
$to = "user@domain.com";
$subject = "Software Download";
$message = "<html><head><title></title></head><body><b>";
// for lines longer than 70 characters, we should use wordwrap()
// $message = wordwrap($message, 70);
$message .= "\n<br \>" . $user;
$message .= "\n<br \>" . $ip;
$message .= "\n<br \>" . $date_time;
$message .= "</b>";
$message .= "\n<br \>" . $request_method . " " . $request_uri;
$message .= "\n<br \>" . $user_agent;
$message .= "</body></html>";
$headers = "";
$headers .= "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
/*
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers = 'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
$headers .= 'Cc: ccer@example.com' . "\r\n";
$headers .= 'Bcc: bccer@example.com' . "\r\n";
$headers .= 'To: name <first@example.com>, 2name <second@example.com>' . "\r\n";
$to = 'first@example.com' . ', '; // note the comma for multiple recipients
$to .= 'second@example.com';
*/
mail($to, $subject, $message, $headers);
?>