Bulk email import module
Today topic is email import. Suppose we have lots of email id(s) in the notepad file in CSV format and suppose
we require uploading all these email id to our database table.So, for such kind of system we are creating
email import .
For this system we require a table i.e newsletter and fields are nd, email.So let’s create a table. So here
we have our table. Now move on to the file. Creating a new file i.e email_import.php. First creating a form.
Opening this file email import. Now first we have to upload this file to our server. So we are using
move_uploaded_file function. here we have 2 parameters. Here will be temporarily path and the second one in
For better practice, let us create a new file , we can create a text file
anywhere i.e sample.txt .Writing some email in that file and separating all these email with a comma.
If you are uploading anything using form,y you must have to mention encrypt multipart form data. So the next
step is to allow to open the file and read all contents inside that.open function and here we have 2
params first one is file name and other is mode i.e ‘a+’ mode. It has now opened the file in read/write mode. here we have data variables.
We have to insert all these emails to separate rows means one email to one row and another email to others.It
Explode function trims all values from string to array .using for each loop we can insert all these individual
email to our database table.Here we have a mysql query .Columns name email and value $value.But before
executing any MySQL query, we must have to connect with our server and select our database.So doing these
things, above all, it’s codes. We are using xampp so username ‘root’ and password null. Now selecting database, provide the database name .