PDA

View Full Version : PHP Autoresponder


The Waiter
11-06-2006, 03:36 AM
Hey!!

I have made/pasted together a PHP mail form with an autorsponder -
It works - but gathers the wrong information to display who the autoresponder is from & their email address. Currently it grabs an apache address.

No I realise my $headers request in the autoresponder mail () is what the problem is - but how do I make it work otherwise?

My PHP is:

<?php
$sendTo = "test@test.com";
$subject = "Test PHP MAIL";
$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);

$filename = "answer.txt";
$fd = fopen( $filename, "r" );
$contents = fread( $fd, filesize( $filename ) );
fclose( $fd );



mail("$headers", "Auto Responder Subject Heading", "$contents\n\n");

$signal=1;
echo "signal=$signal";

?>

The Waiter
11-06-2006, 06:56 AM
After an overwhealming lack of response I have fudged this PHP file which works - (I understand that it probably midnight everywhere else)
It would be cool if I could work out how to make it 'proper' ie have the responding company's name instead of the email address in the 'name' column of your mailbox - but this is just going to have to do - as it works!! (It's a miracle).


<?php
$sendTo = "your@mail.com";
$subject = "Test PHP MAIL";
$headers = "From: $MailFrom" . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];

mail($sendTo, $subject, $message, $headers);

$filename = "answer.txt";
$fd = fopen( $filename, "r" );
$contents = fread( $fd, filesize( $filename ) );
fclose( $fd );
$headers2 = "<" . $_POST["email"] . ">\r\n";

mail("$headers2", "Auto Responder Subject Heading", "$contents\n\n",
"From:your@mail.com\n");

$signal=1;
echo "signal=$signal";

?>

Flash Gordon
11-06-2006, 08:35 AM
After an overwhealming lack of response

:rolleyes: