Welcome to WebmasterWorld Guest from 50.16.112.199

Forum Moderators: coopster & jatar k

PHP form: auto-reply & send data email

   
9:04 pm on Dec 22, 2008 (gmt 0)

5+ Year Member



I have a form that sends data via email. I would like to auto-reply back to the customer. I'm not sure how to send 2 emails out of the same file. Here is the format of my current working email:

<?
$message = "Emailed variables here";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = $headers . "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers = $headers . "From: email@example.com";

mail( "email@example.com, "Form Data", $message, $headers );
header( "Location: [webmasterworld.com"...] );
?>

I thought I could just add in a 2nd email to this file like below but it didn't work...

<?
$message = "Thank You."
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = $headers . "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers = $headers . "From: email@example.com";

mail( " . $_SESSION['email'] . ", "Form Data", $message, $headers );
header( "Location: [webmasterworld.com"...] );
?>

Any help would be greatly appreciated!

10:25 pm on Dec 22, 2008 (gmt 0)

WebmasterWorld Senior Member dreamcatcher is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi charger9,

You aren`t too far away. You just need to remove the one header function and adjust the message var.


<?
$message = "Emailed variables here";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = $headers . "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers = $headers . "From: email@example.com";

mail( "email@example.com, "Form Data", $message, $headers );

$message2 = "Thank You."
$headers = "MIME-Version: 1.0" . "\r\n";
$headers = $headers . "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers = $headers . "From: email@example.com";

mail( " . $_SESSION['email'] . ", "Form Data", $message2, $headers );
header( "Location: [webmasterworld.com"...] );
?>

dc

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month