Last active
December 16, 2015 08:19
-
-
Save walterdavis/5404879 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach(explode(' ', 'from to subject message') as $field){ | |
$$field = (isset($_POST[$field])) ? trim(strip_tags($_POST[$field])) : ''; | |
} | |
if(isset($_POST['from'])){ | |
mail($to, $subject, $message, 'From: ' . $from, '-f' . $from); | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Mail Test</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style type="text/css" media="screen"> | |
label { display: block } | |
</style> | |
</head> | |
<body> | |
<form action="" method="post" accept-charset="utf-8"> | |
<p> | |
<label for="from">From:</label> | |
<input type="email" name="from" id="from" value="<?php echo $from; ?>"/> | |
</p> | |
<p> | |
<label for="to">To:</label> | |
<input type="email" name="to" id="to" value="<?php echo $to; ?>"/> | |
</p> | |
<p> | |
<label for="subject">Subject:</label> | |
<input type="text" name="subject" id="subject" value="<?php echo $subject; ?>"/> | |
</p> | |
<p> | |
<label for="message">Message:</label> | |
<textarea name="message" id="message" rows="6" cols="40"><?php echo $message; ?></textarea> | |
</p> | |
<p><input type="submit" value="Send"/></p> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment