I have been trying to find a way to attach the html form as well as the file attachment through php. The aim is when the user press submit button, both the HTML form (with visible fields only) and the file attachment (uploaded) are attached as email. This is a kind of HTML email but I want the HTML form attached in the email. I am unable to find any solution ?
Share
You want to send the form values as an attachment instead of in the actual body text of the email? If so, you could create an html page with the data of the form and save it on your server. Then, send it. Let me know if you need help and I’ll post some code. I don’t recommend this approach very much, however. You should be sending it in the body text of the email, in my opinion.
Create the file:
Send the file via php mailer:
Try it and post code if it doesn’t work (probably a new question with your specific problem).
Edit:
To send email with post data, make you form submit to a PHP page with this in it: