関数に以下のコードがあります..ただし、メールに添付ファイルが追加されることはありません。メールは問題なく届きますが、添付ファイルはありません。
ただし、関数からコードを削除し、別のファイル (関数部分なし) を追加すると、同じディレクトリで正常に動作します。
関数内で添付ファイルを追加しないのはなぜですか?
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 = "mark@******.co.uk";
$mail->AddAddress("mark@******.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";
}
}