【问题标题】:PHP form isn't sending email to recipients [closed]PHP表单未向收件人发送电子邮件[关闭]
【发布时间】:2019-06-16 17:17:51
【问题描述】:

我在使用 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);
}
}
?>

【问题讨论】:

  • 我们应该让您知道什么?
  • 删除header("Location:https://webexcel.com.au/thank-you.html");或将其放在mail()发送代码下方。
  • 感谢您的快速回复,请按照您的指导更新我的代码 :) 会告诉您它是否有效
  • 效果太棒了,我添加了 3 个以逗号分隔的收件人电子邮件,发送给除 gmail 帐户之外的所有人

标签: php html email post


【解决方案1】:

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

或 put 低于mail() 发送代码。

它在发送邮件之前重定向你。

【讨论】:

  • 效果太棒了,我添加了 3 个以逗号分隔的收件人电子邮件,发送给除 gmail 帐户之外的所有人
  • @umair,很高兴知道它成功了。
猜你喜欢
  • 2012-09-24
  • 1970-01-01
  • 1970-01-01
  • 2012-05-25
  • 2016-01-27
  • 1970-01-01
  • 2013-02-04
  • 2014-05-13
相关资源
最近更新 更多