Today, We are going to learn steps to send an email with attachment using PHP and Ajax without refreshing the page. Below is the step by step explanation.

Before we are getting started, we need a little bit of knowladge about HTML, CSS, PHP and jQuery.

  1. HTML form that will collect the Information from the user
  2. Ajax will gather all the data submitted by the form and send to process.php to send an email
  3. process.php will check the whether attachment is there or not and trigger a email.


Filename : index.html

This is the page where we have a simple form that collect all the information from the user to send email via PHP mail.

Above form have fields like First Name, Email Address and File attachment. Each input filed has their unique ID to fetch the data once form has submitted.

Note : We have set  enctype=”multipart/form-data” . This is used for file attachment.

Script that gather all information submitted by the Form and pass the data to process.php to send email.




Demo | Download

2 thoughts on “Simple Ajax Form With Email Attachment Using PHP

  1. I do not even know how I ended up here, but I believed this submit used to be great. I don’t recognize who you might be but certainly you’re going to a well-known blogger should you are not already Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *