phpmail is a script written in PHP that allows
you to collect feedback from your site visitors and than email the
information they enter back to yourself. Allows for easy customization
of form fields and layout.
Collect Feedback And Email It To Yourself
This coding example shows how to collect feedback from your site using a form and email the response to yourself.
The first thing we need is the HTML form. Keeping it simple for this example, I ask for only name, email and feedback.
Try the form below to see how the user interface works. You won't really send me an email because that
would generate too much email for me.
PHP Code That Sends the Email
The PHP code to send email is the PHP function mail(). The basic format for this function is:
mail("to", "subject", "message");
mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3");
PHP needs to be installed and setup properly to send mail from the
server. On a Unix-type setup such as Linux, PHP uses your local
sendmail
program. Windows machines use SMTP. If you need to, edit your php.ini file and
set the appropiate SMTP host to send email.
Here's the code to send the email:
<?
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|