Created
April 24, 2016 21:41
-
-
Save aalexeev239/4b39ef6c5445fac90167e53d55a3ed63 to your computer and use it in GitHub Desktop.
simple script for testing email
This file contains hidden or 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
<html> | |
<body> | |
<?php | |
if (isset($_REQUEST['from'])) { //if "email" is filled out, send email | |
//send email | |
$from = $_REQUEST['from'] ; | |
$toemail = $_REQUEST['toemail'] ; | |
$subject = $_REQUEST['subject'] ; | |
$message = $_REQUEST['message'] ; | |
$result = mail($toemail, $subject, $message, "From: $from" ); | |
if ( $result ) { | |
echo "The PHP mail function returned success.<br>"; | |
} else { | |
echo "The PHP mail function returned fail.<br>"; | |
} | |
echo "<br>"; | |
echo "The form was submitted with the following content:<br><br>"; | |
echo "From: $from <br>"; | |
echo "To: $toemail <br>"; | |
echo "Subject: $subject <br>"; | |
echo "Message: $message; <br>"; | |
echo "<br>"; | |
} | |
else | |
//if "email" is not filled out, display the form | |
{ | |
echo "<form method='post' action='mailtest.php'> | |
To: <input name='toemail' type='text' /><br /> | |
From: <input name='from' type='text' /><br /> | |
Subject: <input name='subject' type='text' /><br /> | |
Message:<br /> | |
<textarea name='message' rows='15' cols='40'> | |
</textarea><br /> | |
<input type='submit' /> | |
</form>"; | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment