Created
March 21, 2017 19:27
-
-
Save slavapas/a164ed9dabd0842d17283e0d75afb316 to your computer and use it in GitHub Desktop.
php email code
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 | |
$to = "mail@yourdomain.com"; | |
$from = $_REQUEST['email']; | |
$name = $_REQUEST['name']; | |
$headers = "From: $from"; | |
$subject = "You have a message sent from your site"; | |
$fields = array(); | |
$fields{"name"} = "name"; | |
$fields{"email"} = "email"; | |
$fields{"phone"} = "phone"; | |
$fields{"message"} = "message"; | |
$body = "Here is what was sent:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } | |
$send = mail($to, $subject, $body, $headers); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment