0
함수에 아래 코드가 있습니다. 그러나 전자 메일에 첨부 파일을 추가하지 않습니다. 이메일은 정상적으로 전달되지만 첨부 파일은 없습니다.함수 내에서 phpmailer 코드가 작동하지 않습니다.
그러나 함수에서 코드를 제거하고 함수 파트가없는 별도의 파일을 추가하면 같은 디렉터리에서 제대로 작동합니다.
함수에 첨부 파일을 추가하지 않는 이유는 무엇입니까?
function resendOrder()
{
//global $siteEmailFrom, $siteEmailName, $dir;
require_once('OrderMailer/class.phpmailer.php');// need this to send email
$mail = new PHPMailer();
// Now you only need to add the necessary stuff
// HTML body
$body = "Testing";
// And the absolute required configurations for sending HTML with attachement
$mail->From = "[email protected]******.co.uk";
$mail->AddAddress("[email protected]******.co.uk", "My-webpage Website");
$mail->Subject = "test for phpmailer-3";
$mail->MsgHTML($body);
$mail->AddAttachment("ploxy.jpg");
if(!$mail->Send()) {
echo "There was an error sending the message";
exit;
}
else{
echo "Message was sent successfully";
}
}
감사합니다. 그럴 수 없습니다 : $ filePath = "../images/"; // 이미지의 경로는 빈 문자열이 될 수 있습니다. $ ploxy = $ _FILES [ 'ploxy.jpg'] [ 'tmp_name']; $ mail-> AddAttachment ($ filePath, $ ploxy); – user2183216
아니요, 파일 확장자가 없어야합니다. – Jonast92
도움이되고 문제가 해결되면 동의하십시오. 그것이 아니라면 나는 당신이 정확하게 그것을 구글로 여러 번 해결되었다고 말할 수 있습니다. – Jonast92