PHP表单未向收件人发送电子邮件

时间:2019-01-23 07:10:20

标签: php html email post

我的PHP联系表格有问题;填写表格后,它会向我发送感谢页面,但不会将邮件发送给收件人的邮件……请让我知道谢谢。

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if(isset($_POST['submit'])){
// Fetching variables of the form which travels in URL
$check = getimagesize($_FILES["file"]["tmp_name"]);
$inputname = $_POST['inputname'];
$slogan = $_POST['slogan'];
$inputnumber = $_POST['inputnumber'];
$inputemail = $_POST['inputemail'];
$abn = $_POST['abn'];
$optradio = $_POST['optradio'];
$businesstype = $_POST['businesstype'];
$inputmessage = $_POST['inputmessage'];
$inputmessagearea = $_POST['inputmessagearea'];
$aim = $_POST['aim'];
$admradio = $_POST['admradio'];
$logo = $_POST['logo'];
$images = $_POST['images'];
$menustructure = $_POST['menustructure'];
$list = $_POST['list'];
$colorscheme = $_POST['colorscheme'];
$content = $_POST['content'];
$features = $_POST['features'];
$formcontent=" Business Name: $inputname \n Slogan: $slogan \n Business Phone Number: $inputnumber \n Business Email Address: $inputemail \n ABN: $abn \n Domain Name: $optradio \n Business Type: $businesstype \n Business Service: $inputmessage \n Target Area: $inputessagearea \n Aim: $aim \n Admin Login: $admradio \n Logo: $logo \n Image: $images \n Menu Structure: $menustructure \n Websites You Like: $list \n Color Scheme: $colorscheme  \n Content: $content \n Features: $features \n File: $file";
$recipient = "clientmail@gmail.com";
{
//  To redirect form on a particular page
header("Location:https://webexcel.com.au/thank-you.html");
$headers =  "To: $email\r\n";
mail($recipient, 'Website Brief Form', $formcontent, $headers);
}
}
?>

1 个答案:

答案 0 :(得分:0)

删除header("Location:https://webexcel.com.au/thank-you.html");

或放置在mail()发送代码下方。

正在重定向您,然后再发送邮件。