Skip to content

Instantly share code, notes, and snippets.

@namontec
Last active November 13, 2015 14:31
Show Gist options
  • Save namontec/3a7ba34d1bf2d3449ae3 to your computer and use it in GitHub Desktop.
Save namontec/3a7ba34d1bf2d3449ae3 to your computer and use it in GitHub Desktop.
ajax send mail php
<?php
$recepient = "[email protected]";
$sitename = "site.ru";
$service = trim($_POST["formInputService"]);
$name = trim($_POST["formInputName"]);
$email = trim($_POST["formInputEmail"]);
$tel = trim($_POST["formInputTel"]);
$text = trim($_POST["formInputComment"]);
$message = "Услуга: $service \n\nИмя: $name \nТелефон: $tel \n\nКомментарий: $text";
$pagetitle = "Новая заявка с сайта \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\" \nFrom: $name <$email>");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment