dqdfpmmi022763 2015-05-15 21:28
浏览 9
已采纳

PHP Mail不发送邮件? [重复]

This question already has an answer here:

My php script doesnt send a mail. What's wrong? Do i need headers or other things? Is mail not supported?

Is lorem ipsum a php no mail hack/bug? Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent suscipit ante ultricies neque tincidunt ullamcorper. Ut dictum tincidunt scelerisque. Suspendisse vitae quam in neque pellentesque consectetur. Ut ultrices posuere diam, nec interdum leo mattis eget. In hendrerit, nisi a commodo tempor,

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>

My process page:

<?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');
?>

Thanks, Juul

</div>
  • 写回答

2条回答 默认 最新

  • doufuhao8085 2015-05-15 21:53
    关注

    The mail function, http://php.net/manual/en/function.mail.php, takes 4 parameters; to, subject, body, and headers.

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

    You are passing it 6 parameters. Headers are not required. I don't know what you are trying to send but your subject, body, and headers are in the wrong places.

    Maybe you want...

    mail ($to, 
        $subject, 
        "Message: " . $text, 
        "From: $first_name $last_name <$email>");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示