Page 1 of 1

Email generation based on table entries...

Posted: Fri Jul 02, 2004 3:09 pm
by dardsemail
Can anyone point me to some good code on generating an email based on data that has been submitted to a table.

I'm doing a little shopping cart application and would like to email the customer a copy of their order upon successfully placing the order.

Any suggestions of where to look? Also, I know my web hosting provider provides SMTP mail, but is there any specific information I'll need from them in order to complete the script?

Thanks!

Posted: Fri Jul 02, 2004 3:15 pm
by ol4pr0

Code: Select all

set_time_limit(1200);
	require("Mail.php");
	$headers['From']= "support@{$_SERVER['SERVER_NAME']}";
	$headers['Subject'] ="Registration";
	$to = ($_REQUEST['email']);
	$body  = "Thank you for whatever '".$_POST['formfieldname']."'";
	$body .= '';
	$body .= "This is the time this mail was generated: " . date("F j, Y, g:i a");

	$message=& Mail::Factory('mail');
	$message->send($to,$headers,$body);

Posted: Fri Jul 02, 2004 8:53 pm
by dardsemail
I'd like to try it - can you give me a quick run-down on how it works?

Thanks!

Posted: Sun Jul 04, 2004 2:05 am
by ol4pr0
Hm.. Well basicly what you can do with that. ( using PEAR::MIME) in this case.

create a form.
than get all the vars you want from that form or whatever ( or getting them out of a url or database .. )
those vars, put them in the $_REQUEST or $_POST parts.. and thats it.