PHP Snippet 1:
<?PHP
if(isset($_POST['submit']) && empty($_POST['message'])) {
// If there's no message
echo "Uh oh. Looks like you didn't actually include a
message, friend.<br><br>";
die();
}
$destination = "[email protected]";
$subject = "Message from your alfidomain.com!";
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$fromAddress=$email;
$message = str_replace("\n.", "\n..", $_POST['message']);
// Prevents a new line starting with a period from being omitted
$message = "First Name: ". $fname ."\n Last Name: ".$lname ."\n Email: ". $email ."\n Message: ".$message."\n";
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: " . $fromAddress;
$headers[] = "Subject: " . $subject;
$headers[] = "X-Mailer: PHP/".phpversion();
mail($destination, $subject, $message, implode("\r\n",
$headers));
// mail($to,$subject,$msg,$headers);
echo "Email successfully sent.";
?>