Description
Here i will explain
how to send email in php using php mail() function. The easy and simple way to send
a text email. This is one way to handle sending you the results when a visitor
to your website fills out a form. Just following below php function to fulfill your requirement:
User also searching for how to use string function in php
User also searching for how to use string function in php
< ?php
//if "email" variable is filled out, send email
if (isset($_REQUEST['email'])) {
//Email information
$admin_email = "someone@example.com";
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
//send email
mail($admin_email, "$subject", $message, "From:" . $email);
//Email response
echo "Thank you for Submiting";
}
//if "email" variable is not filled out, display the form
else {
?>
< form method="post" >
Email: < input name="email" type="text" />
Subject: < input name="subject" type="text" />
Message:
< textarea name="message" rows="15" cols="40">
< input type="submit" value="Submit" />
< input type="submit" value="Submit" />
< ?php
}
}
?>
No comments:
Post a Comment