添付ファイルをメールでユーザーに送信しようとしています
PHPメーラーライブラリを使用しています
$mail->AddAddress($pr_email);
$mail->Subject = "Activate your account";
$mail->AddAttachment($data);
$mail->IsHTML(true);
$mail->Body =$message;
if(!$mail->Send())
{
echo "Error sending: " . $mail->ErrorInfo;;
}
Where the $data
is an image uploaded by user here how i am reading the value of file and storing in $data variable
$tmpName = $_FILES['file_upload']['tmp_name'];
$fp = fopen($tmpName, 'r');
$data = fread($fp, filesize($tmpName));
$data = addslashes($data);
fclose($fp);
Unfortunately i am able to receive only message text i am not receiving the attached file along the mail
Please tell me what i am doing wrong ?