I would like to send email with file attached using Html form and phpmailer class. While I am able to send the email properly, i am not able to attach the file with the message. Could anyone who has used phpmailer show me how a file input from a html form can send the message with the file as attachment.
if(!$mailer->Send())
{
echo ‘There was a problem sending this mail!’;
}
else
{
echo ‘Mail sent!’;
}
$mailer->ClearAddresses();
$mailer->ClearAttachments();
}
I’m not very good at php, so would appreciate a detail explaination.
Sorry to be replying after a long time. Have been busy lately. Thanks for the suggestion, however, the change doesn’t seem to work.The email with the body and subject is sent but not the attachment. Why is that so? Does anyone have a working example of the phpmailer class using attachment? Would appreciate all the help.
Thanks for the reply. However, I was looking for an example where the user attaches a file with an email form (as shown in my 1st post) and the email with the file attached is sent to the receiver. My previous script works fine without the file attached. I am not sure why the file doesn’t upload to the upload folder. Any ideas?