如何从输入标签发送附件到电子邮件

时间:2014-07-28 08:49:38

标签: php email post

我想通过html文件输入向电子邮件发送附件。 到目前为止这是我的代码,我能够发送邮件但不能发送ataachment

    <?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$country = $_POST['country'];
$position = $_POST['position'];
$services = $_POST['services'];
$filename = $_POST['filename'];
$formcontent=" First Name: $fname \n Last Name: $lname \n Address: $address \n City:$city \n Postal Code:$zip \n Country: $country \n Position Applied for: $position \n email: $email  \n Services Required: $services \n  Resume: $filename";

$recipient = "rohit@gmail.com";
$subject = "Clinogent - Job Application";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

?>
  <html>
    <head>
        <script>
        function load(){
            window.setTimeout(function() {
                window.location.href="http://www.clinogent.com/currentopeningapply.html";
            },0);
        }
        </script>
    </head>
<body onload="load();">
</body>
 </html>

我如何进一步

1 个答案:

答案 0 :(得分:0)

这是伟大的PHP Mailer类:

https://github.com/PHPMailer/PHPMailer

已经解决了你的问题:

Send File Attachment from Form Using phpMailer and PHP