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


how to send an attachment to email from input tag

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

    <?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>

如何继续

这是一个很棒的PHP Mailer类:

https://github.com/PHPMailer/PHPMailer

已经解决了你的问题:

使用phpMailer和PHP从表单发送文件附件