douyan8070 2014-12-16 06:17
浏览 19

我的PHP脚本不会发送正确的电子邮件

I created a php script for an online application that I have built online. The code seems to be able to send emails, but I the emails I receive do not contain any of the information that are filled into the online application. I am not sure what is wrong...

Help!

HTML

<html>
<p align="left"><form action="application.php" method="get" enctype="multipart/form-data" name="JobApp" lang="en">
<div align="left"><strong>Personal Details</strong></div>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="25%" align="right" valign="top"><span id="sprytextfield1">
      <label for="fullname">Full Name:*</label>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td width="35%" align="left" valign="top"><input name="fullname" type="text" id="fullname" size="35" maxlength="100"></td>
    <td width="40%" align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td align="left" valign="top">&nbsp;</td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top"><span id="sprytextfield2">
      <label for="address">Street Address:*</label>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><input name="address" type="text" id="address" size="35"></td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top"><span id="sprytextfield3">
      <label for="city">City:*</label>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><input name="city" type="text" id="city" size="30"></td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top"><span id="spryselect1">
      <label for="province">Province:*</label>
      <span class="selectRequiredMsg">Please select an item.</span></span></td>
    <td align="left" valign="top"><select name="province" id="province">
    <option selected>Choose...</option>
      <option value="Alberta">Alberta</option>
      <option value="British Columbia">British Columbia</option>
      <option value="Manitoba">Manitoba</option>
      <option value="New Burnswick">New Burnswick</option>
      <option value="Newfoundland and Labrador">Newfoundland and Labrador</option>
      <option value="Nova Scotia">Nova Scotia</option>
      <option value="Ontario">Ontario</option>
      <option value="Others">Others</option>
      <option value="Prince Edward Island">Prince Edward Island</option>
      <option value="Quebec">Quebec</option>
      <option value="Saskatchewan">Saskatchewan</option>
    </select></td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top"><span id="sprytextfield4">
      <label for="postal">Postal Code:*</label>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><input name="postal" type="text" id="postal" size="15" maxlength="7"></td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td align="left" valign="top">&nbsp;</td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top"><span id="sprytextfield5">
      <label for="email">Email Address:*</label>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><input name="email" type="text" id="email" size="35"></td>
    <td align="left">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="top"><span id="sprytextfield6">
      <label for="phone">Phone Number:*</label>
      <span class="textfieldRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><input name="phone" type="text" id="phone" size="25"></td>
    <td align="left"><span id="spryradio1">
      <label>
        <input type="radio" name="phonetype" value="Cell Phone" id="phonetype_0">
        Cell Phone</label>
      <br>
      <label>
        <input type="radio" name="phonetype" value="Home Phone" id="phonetype_1">
        Home Phone</label>
      <br>
      <span class="radioRequiredMsg">Please make a selection.</span></span></td>
  </tr>
</table>


<p><div align="left"><strong> Relevant Experience</strong></div>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="25%" align="right" valign="top"><span id="spryselect2">
      <label for="position">Position of Interest:*</label>
      <span class="selectRequiredMsg">Please select an item.</span></span></td>
    <td width="75%" align="left" valign="top"><select name="position" id="position">
    <option selected>Choose...</option>
      <option value="Director Information Technology">Director Information Technology</option>
      <option value="Director Public Relations">Director Public Relations</option>
      <option value="Logistics Coordinator">Logistics Coordinator</option>
      <option value="Staff Coordinator">Staff Coordinator</option>
    </select>
    </td>
  </tr>
  <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="justify" valign="top"><span id="sprytextarea1">
      <label for="experience">What relevant experiences do you have to the position or conference?*</label>
      <span class="textareaRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><textarea name="experience" id="experience" cols="90" rows="10"></textarea></td>
  </tr>
  <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="justify" valign="top"><span id="sprytextarea2">
      <label for="skills">What skills or qualities do you have that would be an asset to the conference?*</label>
      <span class="textareaRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><textarea name="skills" id="skills" cols="90" rows="10"></textarea></td>
  </tr>
  <tr>
    <td align="right" valign="top">&nbsp;</td>
    <td align="left" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td align="justify" valign="top"><span id="sprytextarea3">
      <label for="vision">What vision or ideas do you have for the conference or WTR?*</label>
      <span class="textareaRequiredMsg">A value is required.</span></span></td>
    <td align="left" valign="top"><textarea name="vision" id="vision" cols="90" rows="10"></textarea></td>
  </tr>
</table></p>


<p><div align="left"><strong>Required Documents</strong></div>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="25%" align="right" valign="top"><label for="resume">Resume:*</label></td>
    <td width="75%" align="left" valign="top"><input type="file" name="resume" id="resume"></td>
  </tr>
  <tr>
    <td align="right" valign="top"><label for="letter">Cover Letter:*</label></td>
    <td align="left" valign="top"><input type="file" name="letter" id="letter"></td>
  </tr>
</table>


<p><div align="left"><strong>Additional Information</strong></div>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="25%" align="justify" valign="top"><label for="information">Do you have any additional information that may help us understand your your fit better?</label></td>
    <td width="75%" align="left" valign="top"><textarea name="information" cols="90" rows="10" id="information"></textarea></td>
  </tr>
</table>

<p><table width="100%" border="0" cellspacing="0" cellpadding="6">
  <tr>
    <td width="50%" align="right"><input name="clear" type="reset" value="Clear Application"></td>
    <td width="50%" align="left"><input name="submit" type="submit" id="submit" onClick="MM_validateForm('fullname','','R','address','','R','city','','R','postal','','R','email','','RisEmail','phone','','R','experience','','R','skills','','R','vision','','R');return document.MM_returnValue" value="Submit Application"></td>
  </tr>
</table>
</p>

</form></p>
</html>

PHP

    <?php

/* Subject and Email Variables */

    $Position = $_POST['position'];
    $emailSubject = "Application for $Position";
    $emailreply = 'WTR Technology Application Confirmation';
    $webMaster = 'shadi@wtr-tech.com';
    $applicant = $_POST['email'];

/* Gathering Data Variables */

    $Name = $_POST['fullname'];
    $Address = $_POST['address'];
    $City = $_POST['city'];
    $Province = $_POST['province'];
    $Postal = $_POST['postal'];

    $Email = $_POST['email'];
    $PhoneNumber = $_POST['phone'];
    $PhoneType = $_POST['phonetype'];

    $Experience = $_POST['experience'];
    $Skills = $_POST['skills'];
    $Vision = $_POST['vision'];

    $Resume = $_FILES['resume'];
    $CoverLetter = $_FILES['letter'];
    $Information = $_POST['information'];

/* Email sent to WTR Technology */

    $body = <<<EOD
PERSONAL DETAILS
<br><hr><hr><br>
Full Name: $Name <br>
<br>
Street Address: $Address <br>
City: $City <br>
Province: $Province <br>
Postal Code: $Postal <br>
<br>
Email address: $Email <br>
Phone Number ($PhoneType): $PhoneNumber <br>
<br>
<br>
RELEVANT EXPERIENCE
<br><hr><hr><br>
Position of Interest: $Position <br>
<br>
What relevant experiences do you have to the position or conference? <br><hr><br>
$Experience <br>
<br>
What skills or qualities do you have that would be an asset to the conference? <br><hr><br>
$Skills <br>
<br>
What vision or ideas do you have for the conference or WTR Technology? <br><hr><br>
$Vision <br>
<br>
<br>
REQUIRED DOCUMENTS
<br><hr><hr><br>
Resume: $Resume <br>
Cover Letter: $CoverLetter <br>
<br>
<br>
ADDITIONAL INFORMATION
<br><hr><hr><br>
Do you have any additional information that may help us understand your your fit better'?' <br><hr><br>
$Information <br>
EOD;

    $bodyreply = <<<EOD
<br>
Dear $Name,<br>
<br>
Your employment application at The WTR Technology has been successfully submitted.  Applications are delivered to our recruiting staff daily and are reviewed as soon as possible. Please note that changes cannot be made to your application after submittal. Should you need to modify any data or add additional documents to your application, please work with your recruiting coordinator once they have contacted you.  Thank you for your interest in an employment at WTR Technology. <br>
<br>
Best Regards <br>
<br>
<br>
<br><hr><br>
WTR Technology <br>
<br>
This e-mail message may contain confidential and/or privileged information.
If you are not an addressee or otherwise authorized to receive this message,
you should not use, copy, disclose or take any action based on this e-mail or
any information contained in the message. If you have received this material
in error, please advise the sender immediately by reply e-mail and delete this
message. Thank you.
EOD;

    $headers = "From: $webMaster
";
    $headers .= "Content-type: text/html
";
    $success = mail($webMaster, $emailSubject, $body, $headers);
?>
  • 写回答

4条回答 默认 最新

  • douyan6871 2014-12-16 06:29
    关注

    Your form method is set to "get".

    <form action="application.php" method="post" enctype="multipart/form-data" name="JobApp" lang="en">
    

    Change to post as per above.

    评论

报告相同问题?

悬赏问题

  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿
  • ¥15 init i2c:2 freq:100000[MAIXPY]: find ov2640[MAIXPY]: find ov sensor是main文件哪里有问题吗
  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab