php邮件和yahoo.com没有vibing [英] php mail and yahoo.com not vibing
问题描述
好的,所以我最近开发了一个php联系表单进行派对查询。
Ok so Ive recently developed a php contact form for party inquiries.
表单向网站发送一个请求,并向填写表单的人发送一个确认信息。
The form sends one request to the website and one confirmation to the person who fills out the form.
在Gmail中似乎正在发送这两封电子邮件。但是,如果您使用雅虎电子邮件填写表单,则只会发送确认。不是请求。这显然是有问题的。所以我试图找出原因。
In gmail it seems that both emails are being sent properly. However, if you fill out the form with a yahoo email it will send only the confirmation. Not the request. This is obviously problematic. So I am trying to figure out why.
我的php如下:
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$guests = $_POST['guests'];
$type = $_POST['type'];
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$message = $_POST['message'];
$formcontent="msg";
$comfirmcontent="msg";
$fromname="mydomain.com";
$fromemail="info@mydomain.com";
$confirmheader=
'From: "' . $fromname . '" <' . $fromemail . '>' . "\r\n" .
'Reply-To: "' . $fromname . '" <' . $fromemail . '>' . "\r\n" .
'X-Mailer: PHP v' . phpversion();
$recipient = "info@mydomain.com";
$subject = "Contact From Website";
$mailheader = "From: $email";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
mail($email, $confirmsubject, $comfirmcontent, $confirmheader) or die("Error!");
header('Location: party-form-thank-you.html')
这封电子邮件不是从雅虎发送的:
So this email isnt sending from yahoo:
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
但这一个是:
mail($email, $confirmsubject, $comfirmcontent, $confirmheader) or die("Error!");
我以为可能是因为
'X-Mailer: PHP v' . phpversion();
在确认电子邮件中已定义,因此我尝试将其写入$ mailheader
was defined in the confirmation email so I tried writing this into the $mailheader
$mailheader = "From: $email" . "\r\n" .
'X-Mailer: PHP v' . phpversion();
...没有工作。
所以我要求你所有的编码朋友帮忙,为什么。
So I am asking you all my coding friends for help as to why.
TIA
推荐答案
@kaiqing
你是正确的,因为变量被定义为与不同的名称相同我认为雅虎有问题,
You were correct, since the variables were defined as the same with different name I think yahoo was having a problem,
我重写了如下:
$name = $_POST['name'];
$email = $_POST['email'];
$fromname="BOULETTESLARDER.COM";
$recipient = "info@bouletteslarder.com";
$subject = "Contact From Website";
$mailheader = 'From: "' . $name . '" <' . $email . '>' . "\r\n" .
'X-Mailer: PHP v' . phpversion();
$confirmheader=
'From: "' . $fromname . '" <' . $recipient . '>' . "\r\n" .
'Reply-To: "' . $fromname . '" <' . $recipient . '>' . "\r\n" .
'X-Mailer: PHP v' . phpversion();
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
mail($email, $confirmsubject, $comfirmcontent, $confirmheader) or die("Error!");
现在,它将提交并发送两封电子邮件到网站&如果填写表单的用户有一个雅虎地址。
Now it will submit and send both emails — to the website & to the user — if a user filling out the form has a yahoo address.
这篇关于php邮件和yahoo.com没有vibing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!