Log in

View Full Version : Resolved Automated Email response?



danny_matthews
03-19-2009, 07:04 PM
Hi again, hope all is well.

Im trying to find a way for an automated email to be sent to the user after they have completed and submited a form upon my website.

Any ideas as to how i tackle this one?

Thanks, Danny.

danny_matthews
03-20-2009, 02:19 PM
No one has any ideas? I think its something to do with the php script?!

Please? anyone!

Schmoopy
03-20-2009, 02:28 PM
After you've done whatever needs doing, like adding their details to the database, just use the mail function. I imagine you take their email so I'll use $_POST['email'] for that.

More on the mail function (http://uk.php.net/manual/en/function.mail.php):



<?php

// Add to the database here, if successful execute the following
// You'll want to do some sort of validation on the email before sending it to avoid sending hundreds of emails that lead nowhere

$to = $_POST['email']; // To the user
$subject = 'Thanks for visiting my site'; // Subject of the message...
$message = 'Hello, ' . $_POST['email'] . "\n Thanks for visiting my site etc..."; // Contents of the email
$headers = 'From: yourwebsite@website.com' . "\r\n" .
'Reply-To: yourwebsite@website.com' . "\r\n";

mail($to, $subject, $message, $headers);
?>



Simple as that really,

Good luck.

danny_matthews
03-20-2009, 11:13 PM
Thank you! I had thought it was something fairly simple, just couldn't quite get there myself. So thank you, it is really appreciated.

Danny.

AlanJ
04-16-2009, 11:18 PM
If you want to send a series of e-mails, you might also consider using an auto responder such as aweber.

Just a thought.
Alan