我不确定我在PHP中使用此电子邮件脚本做错了什么。任何帮助将不胜感激,我以前工作过,不知道我做了什么导致它停止工作。它只是将表单内容通过电子邮件发送到指定的电子邮件地址。
<?php
$action = $_REQUEST['action'];
if ($action=="") /* display the contact form */
{
?>
<div style="width:48%;float:left;background-color:#303334;margin-top:20px;margin-bottom:20px;padding:10px;margin-right:5px;text-align:center;">
<h2 style="color:#fde85c !important;text-shadow: 2px 2px #000;letter-spacing: 0em;display:inline;margin-right:15px;">Email Form:</h2><br />
<form action="" enctype="multipart/form-data" method="post">
<div class="left">
<div>
<input name="name" type="text" id="name" size="40" class="text-input" value="Name" style="width:375px;"/>
</div>
</div>
<div class="left">
<div>
<input name="mailfrom" type="text" size="40" class="text-input" value="Email" style="width:375px;"/>
</div>
</div>
<div class="left">
<div>
<input name="street" type="text" id="street" size="40" class="text-input" value="Street" style="width:375px;"/>
</div>
</div>
<div class="left">
<div>
<input name="city" type="text" id="city" size="40" class="text-input" value="City" style="width:375px;"/>
</div>
</div>
<div class="left">
<div>
<input name="state" type="text" id="state" size="10" class="text-input" value="State" style="width:179px;margin-right:5px;"/>
<input name="zip" type="text" id="zip" size="15" class="text-input"value="Zip Code" style="width:179px;"/>
</div>
</div>
<div class="left">
<div>
<input name="country" type="text" id="country" size="40" class="text-input" value="Country" style="width:375px;"/>
</div>
</div>
<div class="left">
<div>
<input name="phone" type="text" id="phone" size="40" class="text-input" value="Phone Number" style="width:375px;"/>
</div>
</div>
<p>
<label>
<input type="checkbox" name="locate" id="locate ">
<strong>Locate an Installer</strong>
</label>
<strong>
<label>
<input type="checkbox" name="become" id="become">Become an Installer
</label>
</strong>
</p><br/>
<p>The fields above are REQUIRED<br /><br />
<strong>
How did you hear about airkrete® GREENsulation™? <br>Please make a selection.
<span id="sprycheckbox1">
<span class="checkboxRequiredMsg"></span>
</span>
</strong>
</p>
<table style="width:250px;display:block;margin-left:auto;margin-right:auto;">
<tr>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="friend" id="Connection_0">Friend</label></div></td>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="jobspec" id="Connection_1">Job Specification</label></div><br /></td>
</tr>
<tr>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="hgtv" id="Connection_2">HGTV Promotion</label></div></td>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="web" id="Connection_3">Web Browsing</label></div></td>
</tr>
<tr>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="radio" id="Connection_4">Radio</label></div></td>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="tv" id="Connection_5">TV</label></div><br /></td>
</tr>
<tr>
<td><div class="radiox" style="float:left;"><label><input type="radio" name="Connection" value="other" id="Connection_6">Other</label></div></td>
</tr>
</table>
</p>
<p class="clear-fix"> </p>
<br/>
<p><strong>Comments:</strong></p>
<p><textarea name="Comments" cols="43" rows="10" id="formMessage" class="text-input" value="Comments" style="width:375px;height:375px !important;"></textarea></p>
<input type="submit" value="Send Email" name="action" class="submit"/>
</form>
</div>
<div style="width:47%;float:left;background-color:#303334;margin-top:20px;margin-bottom:20px;padding:10px;">
<h2 style="color:#fde85c !important;text-shadow: 2px 2px #000;letter-spacing: 0em;display:inline;margin-right:15px;">Location:</h2><br />
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2915.660278958606!2d-76.56143805974003!3d43.04857881647236!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89d75391ea2def03%3A0x1d25241cc0ea158a!2s2710+E+Brutus+St%2C+Weedsport%2C+NY+13166!5e0!3m2!1sen!2sus!4v1450154004262" frameborder="0" style="border:0;width:100%;height:300px" allowfullscreen></iframe>
2710 E. Brutus St. PO Box 380 <br />
Weedsport, NY 13166 <br /><br />
Office: 315-834-6609 <br />
Cell: 315-237-2104 <br />
Fax: 315-834-7420<br /><br />
E-Mail: info@airkrete.com<br />
Web: www.airkrete.com <br /><br />
<h2 style="color:#fde85c !important;text-shadow: 2px 2px #000;letter-spacing: 0em;display:inline;margin-right:15px;">Need an Installer?</h2><br />
airkrete© Inc. has licensed installers worldwide. Many of our installers travel from City to City, State to State, and even Country to Country. Please fill out the form and we will find the best option service your request.<br /><br />
<h2 style="color:#fde85c !important;text-shadow: 2px 2px #000;letter-spacing: 0em;display:inline;margin-right:15px;">Become an Installer?</h2><br />
Installing airkrete® GREENsulation™ is a great business with many opportunities. Once you have completed the airkrete® GREENsulation™ training program you are an official airkrete® GREENsulation™ Licensed Manufacturer. Please fill out the form and an airkrete® representative will get back to you.
</div>
<?php
}
else /* send the submitted data */
{
$locate = isset($_REQUEST['locate']) ? $_REQUEST['locate'] : "" ;
$become = isset($_REQUEST['become']) ? $_REQUEST['become'] : "" ;
$mailfrom = $_REQUEST['mailfrom'];
$street = $_REQUEST['street'];
$city = $_REQUEST['city'];
$state = $_REQUEST['state'];
$zip = $_REQUEST['zip'];
$country = $_REQUEST['country'];
$phone = $_REQUEST['phone'];
$connection = $_REQUEST['Connection'];
$comments = $_REQUEST['Comments'];
$name = $_REQUEST['name'];
if ((($locate == "") && ($become == "")) || ($mailfrom == "") || ($street == "") || ($city == "") || ($state == "") || ($zip == "") || ($country == "") || ($phone == "") || ($name == ""))
{
echo "Not all required forms were filled out, please fill <a href=\"\">the form</a> again.";
}
else
{
if(($locate == "") && ($comments != "") && ($connection != ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to become an installer. ".$name."'s phone number is ".$phone.". They heard about you from: ".$connection." And left you the following comment: ".$comments;
}
else if(($become == "") && ($comments != "") && ($connection != ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to locate an installer. ".$name."'s phone number is ".$phone.". They heard about you from: ".$connection." And left you the following comment: ".$comments;
}
else if(($locate == "") && ($comments != "") && ($connection == ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to become an installer. ".$name."'s phone number is ".$phone.". They did not say where they heard about Airkrete from, and they left you the following comment: ".$comments;
}
else if(($locate == "") && ($comments == "") && ($connection != ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to become an installer. ".$name."'s phone number is ".$phone.". They heard about you from: ".$connection." Also they left you no comments";
}
else if(($become == "") && ($comments != "") && ($connection == ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to locate an installer. ".$name."'s phone number is ".$phone.". They did not say where they heard about Airkrete from, and they left you the following comment: ".$comments;
}
else if(($become == "") && ($comments == "") && ($connection != ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to locate an installer. ".$name."'s phone number is ".$phone.". They heard about you from: ".$connection." Also they left you no comments";
}
else if(($locate == "") && ($comments == "") && ($connection == ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to become an installer. ".$name."'s phone number is ".$phone.". They did not mention where they heard about you or leave you any comments.";
}
else if(($become == "") && ($comments == "") && ($connection == ""))
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to locate an installer. ".$name."'s phone number is ".$phone.". They did not mention where they heard about you or leave you any comments.";
}
else
{
$message = $name." from ".$street." ".$city." ".$state." ".$zip." ".$country." sent you an email via the contact form on the airkrete website. ".$name." would like to become an installer and would also like to locate one. ".$name." Their phone number is ".$phone.". They heard about you from: ".$connection." And left you the following comment: ".$comments;
}
$from = "From: $name<$mailfrom>\r\nReturn-path: $mailfrom";
$subject = "Someone's interested in either finding an installer or becoming one!";
mail("joseph.roberts@usa.com", $subject, $message, $from);
echo "Email sent!";
}
}
?>
&#13;