我希望从表单中收到我的电子邮件附件

时间:2013-09-19 17:23:51

标签: php html

我已经创建了一个网站的职业表格,我希望人们上传简历,我在邮件中收到它,我做了一些事情,我从文本框接收提交的数据并选择框但我无法收到附件,请帮我收到邮件中的附件,这里是我的表格和php代码:

<form method="post" action="careermail.php">
            <table border="0">
            <tr><td class="text">Name</td></tr>
             <tr><td>
            <input class="txtbox" type="text" name="Name" placeholder="Your Name" required="required" /></td></tr>
             <tr><td class="text">Email</td></tr>
            <tr><td><input class="txtbox" type="email" name="Email" placeholder="Your Email" required="required" /></td></tr>
            <tr><td class="text">Role</td></tr>
           <tr><td><select class="slbox" name="Role">
  <option value="development">Development</option>
  <option value="designing">Designing</option>
  <option value="testing">Testing</option>
  <option value="marketing">Marketing</option>
</select></td></tr>
<tr><td class="text">Upload your resume</td></tr>
<tr><td><input class="file" type="file" name="file" size="40"><br /></td></tr>     
<tr><td style="text-align:right;"> <input class="submit" type="Submit" value="Submit" placeholder="Your Email" /></td></tr>
            </table>
            </form>




<script type="text/javascript"> 
    window.alert("Thank you! We will get back to you shortly."); 
window.location.replace("career.html");
  </script> 



<?php

// VALUES FROM THE FORM

$name      = $_REQUEST['Name'];
$email     = $_REQUEST['Email'];
$role = $_REQUEST['Role'];
$File = $_REQUEST['File'];



$fields = array();
$fields{"Name"} = "Name";
$fields{"Email"} = "Email";
$fields{"Role"} = "Role";
$fields{"File"} = "Message";

// CREATE THE EMAIL

$headers    = "Content-Type: text/plain; charset=iso-8859-1\n";

$headers    = "From: $name $email <$email>\n";

$recipient  = "info@appsysinfotech.com";

$subject    = "Career Form";

$message    = "A message has been sent from: \n\n"; foreach($fields as $a => $b){ $message .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

// SEND THE EMAIL TO YOU

mail($recipient, $subject, $message, $headers);

?>

1 个答案:

答案 0 :(得分:0)

请浏览以下链接。它将向您解释如何使用php -

在邮件中附加文件

PHP: Sending Email (Text/HTML/Attachments)