2016-08-17 151 views
-2

文件附件不能使用此提到的代码。有没有解决方案?此代码中附件文件中的错误是什么?我需要附加所有类型的extn文件。Php窗体到电子邮件附件

<?php 

$c_name=$_POST['c_name']; 
$title=$_POST['title']; 
$comp_name=$_POST['comp_name']; 
$add_1=$_POST['add_1']; 
$add_2=$_POST['add_2']; 
$city=$_POST['city']; 
$state_name=$_POST['state_name']; 
$zip=$_POST['zip']; 
$phone=$_POST['phone']; 
$fax=$_POST['fax']; 
$email=$_POST['email']; 
$message=$_POST['message']; 
$hear=$_POST['hear']; 
$upload_file=$_POST['upload_file']; 



    $body .= "Contact Name: " . $c_name . "\n"; 
    $body .= "Title: " . $title . "\n"; 
    $body .= "Company Name: " . $comp_name . "\n"; 
    $body .= "Address 1: " . $add_1 . "\n"; 
    $body .= "Address 2: " . $add_2 . "\n"; 
    $body .= "City: " . $city . "\n"; 
    $body .= "State/Province: " . $state_name . "\n"; 
    $body .= "Zip Code: " . $zip . "\n"; 
    $body .= "Phone: " . $phone . "\n"; 
    $body .= "Fax: " . $fax . "\n"; 
    $body .= "E-mail: " . $email . "\n"; 
    $body .= "Message: " . $message . "\n"; 
    $body .= "Hear about us from:" . $hear . "\n"; 
    $file .= "". $upload_file . "\n"; 


    //replace with your email 
    mail("[email protected]","New email",$body,$file); 


?> 

回答

1

您可以从PHPMailer Script得到的PHPMailer类,只要你想:)

使用,以及