PHP文件不会发送电子邮件

时间:2011-12-07 08:49:41

标签: php javascript html forms email

我是PHP的新手。我想通过邮件发送数据,但我没有收到错误,也没有邮件。 单击“发送”按钮后,浏览器唯一能做的就是显示空白页面。 我之前使用过PHP代码,(并且它可以工作)所以我认为HTML中有一个问题,(可能是我在Javascript中使用的Div的东西?)我在下面复制了这些:

这是我的(非常长的)HTML代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>





<body>
<div id="content">
<div id="backgroundImage"> 
<div id="form">
   <form method="post" action="kerstlijst.php">
   <div id="form1">
         <div id="rollades">

            <label for="HOH_rollade"> </label>
            <input type="text" name="HOH_rollade" id="HOH_rollade" size="1"/>
            <br/>
             <label for="Runderrollade"> </label>
            <input type="text" name="Runderrollade" id="Runderrollade" size="1"/>
            <br/>
             <label for="Entrecote_rollade"> </label>
            <input type="text" name="Entrecote_rollade" id="Entrecote rollade" size="1"/>
            <br/>
             <label for="Varkensrollade"> </label>
            <input type="text" name="Varkensrollade" id="Varkensrollade" size="1"/>
            <br/>
             <label for="Spekrollade"> </label>
            <input type="text" name="Spekrollade" id="Spekrollade" size="1"/>
            <br/>
             <label for="Schoftrollade"> </label>
            <input type="text" name="Schoftrollade" id="Schoftrollade" size="1"/>
            <br/>
             <label for="Filetrollade"> </label>
            <input type="text" name="" id="Filetrollade" size="1"/>
            <br/>
             <label for="Primerib"> </label>
            <input type="text" name="Primerib" id="Primerib" size="1"/>

            </div>

        <div id="rundvlees">
           <label for="Ossenhaas"> </label>
            <input type="text" name="Ossenhaas" id="Ossenhaas" size="1"/>
            <br/>
             <label for="Entre-cote"> </label>
            <input type="text" name="Entre-cote" id="Entre-cote" size="1"/>
            <br/>
             <label for="Rosbief"> </label>
            <input type="text" name="Rosbief" id="Rosbief" size="1"/>
            <br/>
             <label for="Staartstuk"> </label>
            <input type="text" name="Staartstuk" id="Staartstuk" size="1"/>
            <br/>
             <label for="Kogelbiefstuk"> </label>
            <input type="text" name="Kogelbiefstuk" id="Kogelbiefstuk" size="1"/>
            <br/>
             <label for="Rib_eye_(nat)"> </label>
            <input type="text" name="Rib_eye_(nat)" id="Rib_eye_(nat)" size="1"/>
            <br/>
             <label for="Picania"> </label>
            <input type="text" name="Picania" id="Picania" size="1"/>
            <br/>
             <label for="Poulet"> </label>
            <input type="text" name="Poulet" id="Poulet" size="1"/>
            </div>


       <div id="lamsvlees">
           <label for="Lamsbout"> </label>
            <input type="text" name="Lamsbout" id="Lamsbout" size="1"/>
            <br/>
             <label for="Lamskoteletten"> </label>
            <input type="text" name="Lamskoteletten" id="Lamskoteletten" size="1"/>
            <br/>
             <label for="Lamshaas"> </label>
            <input type="text" name="Lamshaas" id="Lamshaas" size="1"/>
            <br/>
             <label for="French_rack"> </label>
            <input type="text" name="French_rack" id="French_rack" size="1"/>
            <br/>
             <label for="Lamspoulet"> </label>
            <input type="text" name="Lamspoulet" id="Lamspoulet" size="1"/>
            <br/>
             <label for="Lamsworstjes"> </label>
            <input type="text" name="Lamsworstjes" id="Lamsworstjes" size="1"/>
            <br/>
             <label for="Lamsbout_gekr."> </label>
            <input type="text" name="Lamsbout_gekr." id="Lamsbout_gekr." size="1"/>
            </div>
            </div>

      <div id="form2">      
      <div id="varkensvlees">
           <label for="Varkenshaas"> </label>
            <input type="text" name="Varkenshaas" id="Varkenshaas" size="1"/>
            <br/>
             <label for="Varkensfilet"> </label>
            <input type="text" name="Varkensfilet" id="Varkensfilet" size="1"/>
            <br/>
             <label for="Fricandeau"> </label>
            <input type="text" name="Fricandeau" id="Fricandeau" size="1"/>
            <br/>
             <label for="Varkensschnitzel"> </label>
            <input type="text" name="Varkensschnitzel" id="Varkensschnitzel" size="1"/>
            <br/>
             <label for="Gep._schnitzel"> </label>
            <input type="text" name="Gep._schnitzel" id="Gep._schnitzel" size="1"/>
            <br/>
             <label for="Haaskarbonade"> </label>
            <input type="text" name="Haaskarbonade" id="Haaskarbonade" size="1"/>
            <br/>
             <label for="Ribkarbonade"> </label>
            <input type="text" name="Ribkarbonade" id="Ribkarbonade" size="1"/>
             <br/>
             <label for="Sch._Karbonade"> </label>
            <input type="text" name="Sch._Karbonade" id="Sch._Karbonade" size="1"/>
             <br/>
             <label for="Spareribs"> </label>
            <input type="text" name="Spareribs" id="Spareribs" size="1"/>
             <br/>
             <label for="Gebr._Spareribs"> </label>
            <input type="text" name="Gebr._Spareribs" id="Gebr._Spareribs" size="1"/>
            </div>

              <div id="worstsoorten">
           <label for="Drogeworst_3x"> </label>
            <input type="text" name="Drogeworst_3x" id="Drogeworst_3x" size="1"/>
            <br/>
             <label for="Leverworst_(r)"> </label>
            <input type="text" name="Leverworst_(r)" id="Leverworst_(r)" size="1"/>
            <br/>
             <label for="Leverworst_(s)"> </label>
            <input type="text" name="Leverworst_(s)" id="Leverworst_(s)" size="1"/>
            <br/>
             <label for="Ossenworst_st"> </label>
            <input type="text" name="Ossenworst_st" id="Ossenworst_st" size="1"/>
            <br/>
             <label for="Grillworst_st"> </label>
            <input type="text" name="Grillworst_st" id="Grillworst_st" size="1"/>
            <br/>
             <label for="Chorizo_st"> </label>
            <input type="text" name="Chorizo_st" id="Chorizo_st" size="1"/>
            <br/>
             <label for="Merquez"> </label>
            <input type="text" name="Merquez" id="Merquez" size="1"/>
             <br/>
             <label for="Verse_worst"> </label>
            <input type="text" name="Verse_worst" id="Verse_worst" size="1"/>
             <br/>
             <label for="Saucijzen"> </label>
            <input type="text" name="Saucijzen" id="Saucijzen" size="1"/>
             <br/>
             <label for="Rookworst"> </label>
            <input type="text" name="Rookworst" id="Rookworst" size="1"/>
             <br/>
             <label for="R._rookworst"> </label>
            <input type="text" name="R._rookworst" id="R._rookworst" size="1"/>
             <br/>
             <label for="Knoflook_w._3x"> </label>
            <input type="text" name="Knoflook_w._3x" id="Knoflook_w._3x" size="1"/>
             <br/>
             <label for="Paardenworst"> </label>
            <input type="text" name="Paardenworst" id="Paardenworst" size="1"/>
            </div>

            <div id="overig">
           <label for="Cowboyvlees"> </label>
            <input type="text" name="Cowboyvlees" id="Cowboyvlees" size="1"/>
            <br/>
             <label for="Maharadjavlees"> </label>
            <input type="text" name="Maharadjavlees" id="Maharadjavlees" size="1"/>
            <br/>
             <label for="Gebr._Rollade"> </label>
            <input type="text" name="Gebr._Rollade" id="Gebr._Rollade" size="1"/>
            <br/>
             <label for="Beenham/vers"> </label>
            <input type="text" name="Beenham/vers" id="Beenham/vers" size="1"/>
            <br/>
             <label for="Zeeuwsspek"> </label>
            <input type="text" name="Zeeuwsspek" id="Zeeuwsspek" size="1"/>
            <br/>
             <label for="English_bacon"> </label>
            <input type="text" name="English_bacon" id="English_bacon" size="1"/>
            <br/>
             <label for="Pancetta"> </label>
            <input type="text" name="Pancetta" id="Pancetta" size="1"/>
             <br/>
             <label for="Rookspek"> </label>
            <input type="text" name="Rookspek" id="Rookspek" size="1"/>
             <br/>
             <label for="Filet_americain"> </label>
            <input type="text" name="Filet_americain" id="Filet_americain" size="1"/>
             <br/>
             <label for="Rolpens"> </label>
            <input type="text" name="Rolpens" id="Rolpens" size="1"/>
            </div>
            </div>

        <div id="form3">      
          <div id="kalfsvlees">
           <label for="Kalfsentrecote"> </label>
            <input type="text" name="Kalfsentrecote" id="Kalfsentrecote" size="1"/>
            <br/>
             <label for="Kalfsschnitzel"> </label>
            <input type="text" name="Kalfsschnitzel" id="Kalfsschnitzel" size="1"/>
            <br/>
             <label for="Kalfsschenkel"> </label>
            <input type="text" name="Kalfsschenkel" id="Kalfsschenkel" size="1"/>
            <br/>
             <label for="Kalfszwezerik"> </label>
            <input type="text" name="Kalfszwezerik" id="Kalfszwezerik" size="1"/>
            <br/>
             <label for="Kalfspoulet"> </label>
            <input type="text" name="Kalfspoulet" id="Kalfspoulet" size="1"/>
            </div>
            </div>

            <div id="form4">
            <div id="gourmet/fondue">
           <label for="Gourmet_de_Luxe"> </label>
            <input type="text" name="Gourmet_de_Luxe" id="Gourmet_de_Luxe" size="1"/>
            <br/>
             <label for="Gourmet_Populair"> </label>
            <input type="text" name="Gourmet_Populair" id="Gourmet_Populair" size="1"/>
            <br/>
             <label for="Fondue"> </label>
            <input type="text" name="Fondue" id="Fondue" size="1"/>
            </div>
            </div>

           <div id="form5">
                    <label for="Naam"> </label>
                            <input type="text" name="Naam" id="Naam" size="30"/> <br/>
                     <label for="Adres"></label>
                      <input type="text" name="Adres" id="Adres" size="30" /> <br/>
                    <label for="Tel."></label>
                      <input type="text" name="Tel." id="Tel." size="30" /> <br/>
                    <label for="Afhaaldatum"></label>
                      <input type="Afhaaldatum" name="Afhaaldatum" id="Afhaaldatum" size="30" /> <br/><br/>
                      <input type="submit" value="verzend"/>
           </div>


        </form>
</div>
</div>
</div>
</body>
</html>

有人可以帮我解决这个问题吗? 提前谢谢!

-Kim

编辑PHP:

这是我的PHP代码, 希望有人能够现在找到问题:

<?php


$to = 'info@yourmail.nl'; 
$onderwerp = " Kerstbestelling "; ;

$Naam = htmlspecialchars($_POST['Naam']); 
$Adres = htmlspecialchars($_POST['Adres']);
$Tel. = htmlspecialchars($_POST['Tel.']);  
$Afhaaldatum = htmlspecialchars($_POST['Afhaaldatum']);

//Rolades
$HOH_rollade = htmlspecialchars($_POST['HOH_rollade']);  
$Runderrollade = htmlspecialchars($_POST['Runderrollade']);
$Entrecote_rollade = htmlspecialchars($_POST['Entrecote_rollade']);
$Varkensrollade = htmlspecialchars($_POST['Varkensrollade']);
$Spekrollade = htmlspecialchars($_POST['Spekrollade']);
$Schoftrollade = htmlspecialchars($_POST['Schoftrollade']);
$Filetrollade = htmlspecialchars($_POST['Filetrollade']);
$Primerib = htmlspecialchars($_POST['Primerib']);

//Rundvlees
$Ossenhaas = htmlspecialchars($_POST['Ossenhaas']);  
$Entre-cote = htmlspecialchars($_POST['Entre-cote']);
$Rosbief = htmlspecialchars($_POST['Rosbief']);
$Staartstuk = htmlspecialchars($_POST['Staartstuk']);
$Kogelbiefstuk = htmlspecialchars($_POST['Kogelbiefstuk']);
$Rib_eye_(nat) = htmlspecialchars($_POST['Rib_eye_(nat)']);
$Picania = htmlspecialchars($_POST['Picania']);
$Poulet = htmlspecialchars($_POST['Poulet']);

//Lamsvlees
$Lamsbout = htmlspecialchars($_POST['Lamsbout']);  
$Lamskoteletten = htmlspecialchars($_POST['Lamskoteletten']);
$Lamshaas = htmlspecialchars($_POST['Lamshaas']);
$French_rack = htmlspecialchars($_POST['French rack']);
$Lamspoulet = htmlspecialchars($_POST['Lamspoulet']);
$Lamsworstjes = htmlspecialchars($_POST['Lamsworstjes']);
$Lamsbout_gekr. = htmlspecialchars($_POST['Lamsbout_gekr.']);

//Varkensvlees
$Varkenshaas = htmlspecialchars($_POST['Varkenshaas']);  
$Varkensfilet = htmlspecialchars($_POST['Varkensfilet']);
$Fricandeau = htmlspecialchars($_POST['Fricandeau']);
$Varkensschnitzel = htmlspecialchars($_POST['Varkensschnitzel']);
$Gep._schnitzel = htmlspecialchars($_POST['Gep._schnitzel']);
$Haaskarbonade = htmlspecialchars($_POST['Haaskarbonade']);
$Ribkarbonade = htmlspecialchars($_POST['Ribkarbonade']);
$Sch._Karbonade = htmlspecialchars($_POST['Sch._Karbonade']);
$Spareribs = htmlspecialchars($_POST['Spareribs']);
$Gebr._Spareribs = htmlspecialchars($_POST['Gebr._Spareribs']);

//Worstsoorten
$Drogeworst_3x = htmlspecialchars($_POST['Drogeworst_3x']);  
$Leverworst_(r) = htmlspecialchars($_POST['Leverworst_(r)']);
$Leverworst_(s) = htmlspecialchars($_POST['Leverworst_(s)']);
$Ossenworst_st = htmlspecialchars($_POST['Ossenworst_st']);
$Grillworst_st = htmlspecialchars($_POST['Grillworst_st']);
$Chorizo_st = htmlspecialchars($_POST['Chorizo_st']);
$Merquez = htmlspecialchars($_POST['Merquez']);
$Verse_worst = htmlspecialchars($_POST['Verse_worst']);
$Saucijzen = htmlspecialchars($_POST['Saucijzen']);
$Rookworst = htmlspecialchars($_POST['Rookworst']);
$R._rookworst = htmlspecialchars($_POST['R._rookworst']);
$Knoflook_w._3x = htmlspecialchars($_POST['Knoflook_w._3x']);
$Paardenworst = htmlspecialchars($_POST['Paardenworst']);

//Overig
$Cowboyvlees = htmlspecialchars($_POST['Cowboyvlees']);  
$Maharadjavlees = htmlspecialchars($_POST['Maharadjavlees']);
$Gebr._Rollade = htmlspecialchars($_POST['Gebr._Rollade']);
$Beenham/vers = htmlspecialchars($_POST['Beenham/vers']);
$Zeeuwsspek = htmlspecialchars($_POST['Zeeuwsspek']);
$English_bacon = htmlspecialchars($_POST['English_bacon']);
$Pancetta = htmlspecialchars($_POST['Pancetta']);
$Rookspek = htmlspecialchars($_POST['Rookspek']);
$Filet_americain = htmlspecialchars($_POST['Filet_americain']);
$Rolpens = htmlspecialchars($_POST['Rolpens']);

//Kalfsvlees
$Kalfsentrecote = htmlspecialchars($_POST['Kalfsentrecote']);  
$Kalfsschnitzel = htmlspecialchars($_POST['Kalfsschnitzel']);
$Kalfsschenkel = htmlspecialchars($_POST['Kalfsschenkel']);
$Kalfszwezerik = htmlspecialchars($_POST['Kalfszwezerik']);
$Kalfspoulet = htmlspecialchars($_POST['Kalfspoulet']);

//Gourmet / Fondue
$Gourmet_de_Luxe = htmlspecialchars($_POST['Gourmet_de_Luxe']);  
$Gourmet_Populair = htmlspecialchars($_POST['Gourmet_Populair']);
$Fondue = htmlspecialchars($_POST['Fondue']);


$details = "
   Onderwerp: $onderwerp\n\n\n
   Naam: $Naam\n\n
   Adres: $Adres\n\n
   Tel.: $Tel. \n\n
   Afhaaldatum: $Afhaaldatum \n\n
   \n\n

   HOH_rollade: $HOH_rollade \n\n
   Runderrollade: $Runderrollade \n\n
   Entrecote_rollade: $Entrecote_rollade \n\n
   Varkensrollade: $Varkensrollade \n\n
   Spekrollade: $Spekrollade \n\n
   Schoftrollade: $Schoftrollade \n\n
   Filetrollade: $Filetrollade \n\n
   Primerib: $Primerib \n\n
   \n\n

   Ossenhaas: $Ossenhaas \n\n
   Entre-cote: $Entre-cote \n\n
   Rosbief: $Rosbief \n\n
   Staartstuk: $Staartstuk \n\n
   Kogelbiefstuk: $Kogelbiefstuk \n\n
   Rib eye (nat): $Rib_eye_(nat) \n\n
   Picania: $Picania \n\n
   Poulet: $Poulet \n\n
   \n\n

    Lamsbout: $Lamsbout \n\n
    Lamskoteletten: $Lamskoteletten \n\n
    Lamshaas: $Lamshaas \n\n
    French rack: $French_rack \n\n
    Lamspoulet: $Lamspoulet \n\n
    Lamsworstjes: $Lamsworstjes \n\n
    Lamsbout gekr.: $Lamsbout_gekr. \n\n
    \n\n

    Varkenshaas: $Varkenshaas \n\n
    Varkensfilet: $Varkensfilet \n\n
    Fricandeau: $Fricandeau \n\n
    Varkensschnitzel: $Varkensschnitzel \n\n
    Gep._schnitzel: $Gep._schnitzel \n\n
    Haaskarbonade: $Haaskarbonade \n\n
    Ribkarbonade: $Ribkarbonade \n\n
    Sch._Karbonade: $Sch._Karbonade \n\n
    Spareribs: $Spareribs \n\n
    Gebr._Spareribs: $Gebr._Spareribs \n\n
    \n\n

    Drogeworst_3x: $Drogeworst_3x \n\n
    Leverworst_(r): $Leverworst_(r) \n\n
    Leverworst_(s): $Leverworst_(s) \n\n
    Ossenworst_st: $Ossenworst_st \n\n
    Grillworst_st: $Grillworst_st \n\n
    Chorizo_st: $Chorizo_st \n\n
    Merquez: $Merquez \n\n
    Verse_worst: $Verse_worst \n\n
    Saucijzen: $Saucijzen \n\n
    Rookworst: $Rookworst \n\n
    R._rookworst: $R._rookworst \n\n
    Knoflook_w._3x: $Knoflook_w._3x \n\n
    Paardenworst: $Paardenworst \n\n
    \n\n

    Cowboyvlees: $Cowboyvlees \n\n
    Maharadjavlees: $Maharadjavlees \n\n
    Gebr._Rollade: $Gebr._Rollade \n\n
    Beenham/vers: $Beenham/vers\n\n
    Zeeuwsspek: $Zeeuwsspek \n\n
    English_bacon: $English_bacon \n\n
    Pancetta: $Pancetta \n\n
    Rookspek: $Rookspek \n\n
    Filet_americain: $Filet_americain \n\n
    Rolpens: $Rolpens \n\n
    \n\n

    Kalfsentrecote: $Kalfsentrecote \n\n
    Kalfsschnitzel: $Kalfsschnitzel \n\n
    Kalfsschenkel: $Kalfsschenkel \n\n
    Kalfszwezerik: $Kalfszwezerik \n\n
    Kalfspoulet: $Kalfspoulet \n\n
    \n\n

    Gourmet_de_Luxe: $Gourmet_de_Luxe \n\n
    Gourmet_Populair: $Gourmet_Populair \n\n
    Fondue: $Fondue \n\n


  ";





// Send the message
$ok = mail($to, $onderwerp, $details);
if ($ok) {
  echo "<p>E-mail is verzonden</p>";
} else {
  echo "<p>Mail could not be sent. Sorry!</p>";
}


?> 

1 个答案:

答案 0 :(得分:0)

一切看起来都不错,只需要'onderwerp'就行了2个分号,删除一个。不确定这是否能解决你的问题,但这是要解决的问题

$to = 'info@yourmail.nl'; 
$onderwerp = " Kerstbestelling "; ; <----

编辑:我也不建议在变量名中使用点和()。只有字母和下划线