On Friday 21 February 2003 07:26 am, H. Carter Harris wrote:
> How does one get the ability to email using PHP?
change "to" and "from" in the script below and it should get you through the
night
<?php
$to = '[EMAIL PROTECTED]';
$from = '[EMAIL PROTECTED]';
//Check if we have something POSTed by the form.
if (isset($HTTP_POST_VARS)){
//Start with an empty body for the mail message
$body = '';
//Iterate through all the POSTed variables, and add them tothe
messa
ge body.
while (list($key, $value) = each($HTTP_POST_VARS)){
$body .= $key . ' = ' . $value . "\r\n";
}
//Build up some nice From/Reply Headers
$headers = "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
//Mail the message out.
//Requires setting php3.ini sendmail path as per instructions
$success = mail($to, "Posted " . date("m/d/Y"), $body,
$headers);
//Always check return codes from functions.
if ($success){
echo "<B><CENTER>Thank you for your Interest</CENTER></B>\n";
}
else{
echo "<CENTER><B>Internal Error</B>: Your input was
unprocessed
.<BR>Contact $from</CENTER>\n";
}
}
?>
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com