homepage Welcome to WebmasterWorld Guest from 107.21.187.131
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
PHP form: auto-reply & send data email
charger9




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

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: https://www.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: https://www.webmasterworld.com" );
?>

Any help would be greatly appreciated!

 

dreamcatcher




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

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: https://www.webmasterworld.com" );
?>

dc

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved