0
연락 양식을 만들려고합니다. 지금은이 양식이까지 :phpMailer를 사용하여 PHP 양식의 첨부 파일을 보내지 않았습니다.
<form method="post" action="email.php">
Name: <input name="name" id="name" type="text" /><br />
Email: <input name="email" id="email" type="text" /><br />
Subject: <input name="subject" id="subject" type="text" /><br />
Message:<br />
<textarea name="message" id="message" rows="15" cols="40"></textarea><br />
Βιογραφικό: <input type ="file" name='attachment' id='uploaded_file'>
<input type="submit" value="Submit" />
</form>
을이이 email.php로
<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
require("PHPMailer/PHPMailerAutoload.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->Host = "localhost"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "xxxxxxxx"; // SMTP password
$mail->From = $email;
$mail->SetFrom("[email protected]","xxx.xx");
$mail->AddAddress("[email protected]", "mikroviologos.gr");
$mail->AddReplyTo($_POST["email"], $_POST["name"]);
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "You have received feedback from your website!";
$mail->Subject = $_POST["subject"];
$mail->Body = $message;
$mail->AltBody = $message;
$mail->addAttachment($_FILES['attachment']['tmp_name'],$_FILES['attachment']['name']);
?>
될 수 있으며, 메시지는 정상적으로 전송하지만, 무엇이든 내가 시도되는 첨부 파일이 전송되지 않습니다. 메일에 첨부하기 위해 어딘가에 파일을 저장할 필요가 없습니다.
감사합니다.
오류 출력의 내용은 무엇입니까? 나는 서버 환경이 임시 업로드 파일의 첨부를 막을 수 있다는 보안상의주의 사항으로, 파일을 첨부하기 위해 참조하기 전에 파일을 이동하고 올바르게 저장해야한다고 생각합니다. – Martin
아, 그 오래된 밤. 잘 찾았습니다. 아마도이 정보를 자신의 질문에 대한 답변으로 추가하여 다른 사람들이 그 정보를 알 수 있도록 할 수 있습니다 :) – Martin