Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP邮件不发送邮件吗?_Php_Email - Fatal编程技术网

PHP邮件不发送邮件吗?

PHP邮件不发送邮件吗?,php,email,Php,Email,我的php脚本不发送邮件。发生了什么?我需要页眉还是其他东西?不支持邮件吗 lorem ipsum是php无邮件黑客/bug吗? Lorem ipsum dolor sit amet,是一位杰出的献身者。预防ullamcorper公司的后续行动。这是我的格言。在内克佩伦茨克的圣殿里,生活暂停。这是我们的梦想,也是利奥·马蒂斯·埃吉特的梦想。在hendrerit,nisi是一名临时指挥官 My index.php <!-- Form --> <form ac

我的php脚本不发送邮件。发生了什么?我需要页眉还是其他东西?不支持邮件吗

lorem ipsum是php无邮件黑客/bug吗? Lorem ipsum dolor sit amet,是一位杰出的献身者。预防ullamcorper公司的后续行动。这是我的格言。在内克佩伦茨克的圣殿里,生活暂停。这是我们的梦想,也是利奥·马蒂斯·埃吉特的梦想。在hendrerit,nisi是一名临时指挥官

My index.php

       <!-- Form -->
    <form action="apply-process.php" method="post" name="apply">
  <div class="row">
    <div class="six columns">
      <label>Your first name</label>
      <input class="u-full-width" type="text" placeholder="John" name="first_name">
    </div>
    <div class="six columns">
      <label>Your last name</label>
      <input class="u-full-width" type="text" placeholder="Doe" name="last_name">
    </div>
  </div>
  <div class="row">
    <div class="six columns">
      <label>Your email</label>
      <input class="u-full-width" type="text" placeholder="john@doe.com" name="email">
    </div>
    <div class="six columns">
      <label>Memberschip</label>
      <select name="memberschip" class="u-full-width" name="membership">
        <option value="Option 1">Normal</option>
        <option value="Option 2">Donator</option>
        <option value="Option 3">eSport member</option>
      </select>
    </div>
  </div>

  <label>Message</label>
  <textarea class="u-full-width" placeholder="Tell us something about yourself and your hobbies. Remember to include your ingame name and Skype name." name="text"></textarea>

  <input class="button-primary" type="submit" value="Submit">
</form>

你的名字
你的姓
你的电子邮件
Memberschip
正常的
捐赠者
电子竞技会员
消息
我的流程页面:

<?php

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$text = $_POST['text'];
$membership = $_POST['membership'];
$to = "administratie@sharp-gaming.nl";
$subject = "New apply from $first_name";

mail ($to, $subject, "From: " . $first_name . $last_name, "Email: " . $email, "Membership: " . $membership, "Message: " . $text);

header('Location: ../index.html');
?>


谢谢,Juul,这可能会有所帮助。将您的
mail()
替换为以下行:

$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: ' .$first_name.$last_name. '<' .$email. '>' . "\r\n";
mail($to,$subject,$text,$headers);
$headers=“MIME版本:1.0”。“\r\n”;
$headers.=“内容类型:text/html;字符集=UTF-8”。“\r\n”;
$headers.='From:'.$first\u name.$last\u name.''。“\r\n”;
邮件($to、$subject、$text、$headers);
邮件功能,采用4个参数;收件人、主题、正文和标题

mail ($to, 
$subject, 
"From: " . $first_name . $last_name, 
"Email: " . $email, 
"Membership: " . $membership, 
"Message: " . $text);
您正在传递它6个参数。标题不是必需的。我不知道你想发送什么,但是你的主题、正文和标题放错了地方

也许你想要

mail ($to, 
    $subject, 
    "Message: " . $text, 
    "From: $first_name $last_name <$email>");
mail($to),
$subject,
“消息:”.$text,
“发件人:$first_name$last_name”);

您需要标题是。此外,请确保您的服务器已配置为发送电子邮件,并确保为您的代码打开了错误报告。请参阅本页上的一些示例:@Maximus2012为什么OP需要标题?根据链接
附加标题(可选)
。也许有它们是一个更好的主意,这样它就不会成为垃圾邮件,但不是必需的。你说的是什么意思“lorem ipsum是php无邮件黑客/bug吗?Lorem ipsum dolor sit amet,是一位杰出的献身者。预防ullamcorper公司的后续行动。这是我的格言。在内克佩伦茨克的圣殿里,生活暂停。这是我们的梦想,也是利奥·马蒂斯·埃吉特的梦想。在hendrerit,nisi a commodo tempor中,“?是的,这不是你的原始代码吗?你试过上面的代码了吗/读过了吗?我的代码没有6个参数指向
mail
函数。