我使用this php mailer 每件事情都是O.k.但是當我附加一個文件時,目標電子郵件中的文件受損。例如,當我發送一個PDF文件接收器無法打開它。當通過PHP郵件發送文件將會損壞
,這是我使用PHPMailer的代碼:
$target_path = "upload_files/";
$target_path = $target_path . basename($_FILES['attach']['name']);
if(move_uploaded_file($_FILES['attach']['tmp_name'], $target_path)) {
} else{
}
//eupload file end
require_once 'phpmailer/phpmailer.inc.php';
$mail = new PHPMailer();
$body = $message;
$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo($email, $fname." ".$lname);
$mail->FromName = $fname." ".$lname;
$mail->From = $email;
$mail->AddAddress("email address", "some one");
$mail->Subject = "something";
$mail->body = $body;
$mail->AddAttachment($target_path); // attachment
if(!$mail->Send()) {
} else {
}
你能展示一些相關的!代碼,現在我們必須猜測出了什麼問題。 – Tarilo
@Tarilo你想要什麼?損壞的文件?如果你想我可以上傳文件收到的已損壞的文件 – Ehsan