<?php
// Only process POST reqeusts.
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Get the form fields and remove whitespace.
$name = strip_tags(trim($_POST["name"]));
$name = str_replace(array("\r","\n"),array(" "," "),$name);
$email = filter_var(trim($_POST["email"]), FILTER_SANITIZE_EMAIL);
$message = trim($_POST["message"]);
// Check that data was sent to the mailer.
if ( empty($name) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) {
// Set a 400 (bad request) response code and exit.
http_response_code(400);
echo "Please complete the form and try again.";
exit;
}
// Set the recipient email address.
// FIXME: Update this to your desired email address.
$recipient = "hridoycse1428@gmail.com";
// Set the email subject.
$subject = "New contact from $name";
// Build the email content.
$email_content = "Name: $name\n";
$email_content .= "Email: $email\n\n";
$email_content .= "Message:\n$message\n";
// Build the email headers.
$email_headers = "From: $name <$email>";
// Send the email.
if (mail($recipient, $email_content, $email_headers)) {
// Set a 200 (okay) response code.
http_response_code(200);
echo "Thank You! Your message has been sent.";
} else {
// Set a 500 (internal server error) response code.
http_response_code(500);
echo "Oops! Something went wrong and we couldn't send your message.";
}
} else {
// Not a POST request, set a 403 (forbidden) response code.
http_response_code(403);
echo "There was a problem with your submission, please try again.";
}
?>
DTcode7
- 粉丝: 3w+
- 资源: 4986
最新资源
- libnftnl-1.0.8-3.el7.x64-86.rpm.tar.gz
- libnftnl-devel-1.0.8-3.el7.x64-86.rpm.tar.gz
- libnice-0.1.3-4.el7.x64-86.rpm.tar.gz
- libnice-devel-0.1.3-4.el7.x64-86.rpm.tar.gz
- libnl-1.1.4-3.el7.x64-86.rpm.tar.gz
- libnl-devel-1.1.4-3.el7.x64-86.rpm.tar.gz
- libnl3-3.2.28-4.el7.x64-86.rpm.tar.gz
- STM32三轴联动插补(直线圆弧带插补与加减速)源码解析,基于STM32F1与STM32F4平台,国外脱机雕刻机源码中文注释版,STM32 三轴联动 带插补 加减速 源代码 MDK 源码 分别基于ST
- libnl3-cli-3.2.28-4.el7.x64-86.rpm.tar.gz
- 台达PLC与中达电通触摸屏通讯程序:智能轮询四路仪表数据,实时监测功率与电流,独立四路报警输出,实用性强且具备自动逻辑流程,台达PLC通讯程序,PLC采用台达,触摸屏采用中达电通触摸屏软件编辑 和四
- libnl3-devel-3.2.28-4.el7.x64-86.rpm.tar.gz
- libnl3-doc-3.2.28-4.el7.x64-86.rpm.tar.gz
- libnm-gtk-1.8.6-2.el7.x64-86.rpm.tar.gz
- libnm-gtk-devel-1.8.6-2.el7.x64-86.rpm.tar.gz
- libnma-1.8.6-2.el7.x64-86.rpm.tar.gz
- CC智慧物业小程序-活动资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈