2015-10-04 66 views
-1

你好,我让这个脚本不能发送电子邮件。我使用后缀(是的,我知道但我想使用后缀)任何想法?它向我发送电子邮件,但没有变量的内容。 谢谢:我的脚本不能发送电子邮件(再次)

的index.html

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge"> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<title>Portfolio</title> 

<!-- Bootstrap --> 
<link rel="stylesheet" href="css/bootstrap.css"> 

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
<!--[if lt IE 9]> 
     <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> 
     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
    <![endif]--> 
</head> 
<body> 
<div class="container"> 
    <div class="row"> 
    <h2 align="center"> Whitelist Request Form </h2> 
    <div class="col-lg-offset-3 col-xs-12 col-lg-6"> 
     <div class="jumbotron"> 
     <div class="row text-center"> 
      <div class="text-center col-xs-12 col-sm-12 col-md-12 col-lg-12"> </div> 
      <div class="text-center col-lg-12"> 
      <!-- CONTACT FORM https://github.com/jonmbake/bootstrap3-contact-form --> 
      <form role="form" id="feedbackForm" class="text-center" action="send_whitelist.php"> 
       <div class="form-group"> 
       <label for="name">Name</label> 
       <input type="text" class="form-control" id="name" name="name" placeholder="Name"> 
       <span class="help-block" style="display: none;">Please enter your name.</span></div> 
       <div class="form-group"> 
       <label for="email">E-Mail</label> 
       <input type="email" class="form-control" id="email" name="email" placeholder="Email Address"> 
       <span class="help-block" style="display: none;">Please enter a valid e-mail address.</span></div> 
       <div class="form-group"> 
       <label for="username">Username</label> 
       <input type="text" class="form-control" id="username" name="username" placeholder="Minecraft Username"></div> 
        <div class="form-group"> 
        <label for="paysafe">Paysafe</label> 
       <input type="number" class="form-control" id="paysafe" name="paysafe" placeholder="XXXX-XXXX-XXXX-XXXX"> 
       <span class="help-block" style="display: none;">Please enter a valid Paysafe number.</span></div> 
       <button type="submit" id="submit" class="btn btn-primary btn-lg" style=" margin-top: 10px;"> Send</button> 
      </form> 
      <!-- END CONTACT FORM --> 
      </div> 
     </div> 
     </div> 
    </div> 
    </div> 
    </div> 
<hr> 
<footer class="text-center"> 
    <div class="container"> 
    <div class="row"> 
     <div class="col-xs-12"> 
     <p>Copyright © NickTehPro 2015. All rights reserved.</p> 
     </div> 
    </div> 
    </div> 
</footer> 
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
<script src="js/jquery-1.11.2.min.js"></script> 
<!-- Include all compiled plugins (below), or include individual files as needed --> 
<script src="js/bootstrap.min.js"></script> 
</body> 
</html> 

send_whitelist.php

<?php 
$username = $_POST['username']; 
$name = $_POST['name']; 
$paysafe = $_POST['paysafe']; 
$email = $_POST['email']; 

// Contact subject 
$subject ="Minecraft Server Whitelist Request"; 

// Details 
$message="Name: $name \nUsername: $username \nPaysafe: $paysafe "; 

// Mail of sender 
$mail_from="$email"; 

// From 
$header="from: $name <$mail_from>"; 

// Enter your email address 
$to ='[email protected]'; 
$send_contact=mail($to,$subject,$message,$header); 

// Check, if message sent to your email 
// display message "We've recived your information" 
if($send_contact){ 
echo "<h2 align="center"> I have received your whitelist request. Please wait.</h2>"; 
} 
else { 
echo "ERROR"; 
} 

?> 
+0

停止downvoting我的意见,并请回答我。这个网站应该帮助人们不让他们打架。 – NicktehPro

+0

我的问题** – NicktehPro

回答

2

没有设置形式method实体形式通过GET提交。 所以你应该设置method="post"

+0

非常感谢! – NicktehPro