example PHP formmail script

1) Sample PHP Form Code:

<form action=phpsend.php method=post>
Your Name:
<input type=text name=name>
<input type=text name=email>
<input type=submit value=Submit>
2) Create a file called phphsend.php with following code (modifying with your address):

//Declare the variables of your form
$subject = “Testing.. 1 2 3”;
$message = “Hi there!”;
$from = “PHP mailer test”;
//Contents of form
$email =$_POST[’email’];
//mail() function sends the mail
mail($recipient,$subject,$message,$from,” -f VALID-USER@THISDOMAIN.COM);

NOTE: -f VALID-USER@THISDOMAIN.COM needs to be a valid user on the local domain so that it will be able to send

Share on Twitter
Share on Facebook