WP-Mix

A fresh mix of code snippets and tutorials

Simple email script with PHP

Here is a simple PHP script for sending email.

<?php // simple email script

$name    = stripslashes(trim($_POST["name"]));
$email   = stripslashes(trim($_POST["mail"]));
$subject = stripslashes(trim($_POST["subject"]));
$message = stripslashes(trim($_POST["message"]));
$sendto  = stripslashes(trim($_POST["maildest"]));

$headers  = "From: $name" . " <$email>" . "\r\n" . "Reply-To: " . "$email" . "\r\n" . "Content-type: text/html; charset=utf-8" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$sendmail = mail($sendto, $subject, $message, $headers);    

if($sendmail) {
	echo "Success!";
} else {
	echo "Failure!";
} ?>

★ Pro Tip:

USP ProSAC Pro