PHP电子邮件功能发送带主题和空格的空白正文消息发件人电邮

时间:2013-07-19 00:21:10

标签: php email forum mailto

我正在尝试创建一个将输入发送到电子邮件的报价论坛。我有PHP发送电子邮件,显示主题和发件人电子邮件,但它没有显示发送的电子邮件中的主体内容..这是我的代码:

 <?php 
 $action=$_REQUEST['action']; 
 if ($action=="")    /* display the contact form */ 
     { 
     ?>
     <div class="quote_text">Send us some of your information and we will get back to you as soon as possible. Let's get this ball rolling.</div>
     <br /><br />
     <span class="important">* = required fields</span><br />

     <form  action="" method="POST" enctype="multipart/form-data">
       <table width="814" height="310" border="0">
       <tr>
         <td width="419">
             <input type="hidden" name="action" value="submit">
             Your Name:<span class="important">*</span><input name="name" type="text" value="" size="30"/><br /><br />
             Your Email:<span class="important">*</span><input name="email" type="text" value="" size="30" placeholder="example@example.com"/><br /><br />
             Phone Number:<input name="phone" type="text" value="" size="10" maxlength="12" placeholder="(xxx)-xxx-xxxx" /><br /><br />
             Company Name:<input name="company_name" type="text" value="" size="30"/><br />     <br />
         </td>
         <td width="385">
             Address of Installation:<span class="important">*</span>
             <input name="install_address" type="text" value="" size="30"/><br /><br />
             City:<span class="important">*</span><input name="city" type="text" value="" size="30"/><br /><br />
             State:<span class="important">*</span><input name="state" type="text" value="" size="30"/><br /><br />
             Zip Code:<span class="important">*</span><input name="zip" type="text" value="" size="30"/><br /><br /><br /><br />
         </td>
       </tr>
       <tr>
         <td height="102">
                 Fence Type Description:<br /><textarea name="description" rows="6" cols="45"></textarea>
                 Number of Corners:<input name="corners" type="text" value="" size="30"/>
             </td>
             <td><br />
                 Linear Feet:<input name="linear" type="text" value="" size="30"/><br />
                 OR<br />
                 Acres:<input name="acres" type="text" value="" size="30"/><br /><br />
                 Number of Gate Openings:<input name="gate_opening" type="text" value="" size="30"/>
         </td>
     </tr>
     </table><br><br> 
     <input type="submit" value="Send email"/> 
   </form> 
     <?php 
     } else { 

     // Grab forum elements and push into variables for the email
     $name              = $_REQUEST['name']; 
     $email             = $_REQUEST['email']; 
     $phone                 = $_REQUEST['phone'];
     $company_name      = $_REQUEST['company_name'];
     $install_address   = $_REQUEST['install_address'];
     $city              = $_REQUEST['city'];
     $state             = $_REQUEST['state'];
     $zip               = $_REQUEST['zip'];
     $description       = $_REQUEST['description'];
     $corners           = $_REQUEST['corners'];
     $linear                = $_REQUEST['linear'];
     $acres             = $_REQUEST['acres'];
     $gate_opening      = $_REQUEST['gate_opening'];



     //Build Email
     $message="$name<br />
               $email<br />
               $phone<br />
               $company_name<br />
               $install_address<br />
               $city<br />
               $state<br />
               $zip<br />
               $description<br />
               $corners<br />
               $linear<br />
               $acres<br />
               $gate_opening<br />";

     $message=$_REQUEST['message']; 
     if (($name=="")||($email=="")||($install_address="")||($city="")||($state="")||     ($zip=""))
         { 
         echo "Please fill the required fields. <a href=\"\">Click here to try again.</a>"; 
         } 
     else{         
         $from="From: $name<$email>\r\nReturn-path: $email"; 
         $subject="Blue Ridge Fencing - Quote Forum"; 
         mail("info@blueridgefenceco.com", $subject, $message, $from); 
         echo "Email sent! We will get back to you as soon as possible."; 
         } 
     }   
 ?> 

非常感谢你的帮助!

0 个答案:

没有答案