Project's name: CRUD Add PHPMailer
This CRUD Project application is a PHP project to create a simple CRUD Web Application for users management. In this project we are adding the email sending functionality using the PHPMailer library. This project uses PHP version 8.2.12, MariaDB database server version 10.4.32, and two external libraries called domPDF and PHPMailer. This project is part of the Pentatech IT Solutions PHP Internship program.
- Login and Signup forms, with session management, developed in the first project.
- Team users dashboard, including name, position, email, photo, and details. All CRUD operations were implemented in the second project.
- Team users list and user deatils PDF report, using the domPDF library, implemented in the third projec.
- Email creation and sending usinf¿g the PHPMailer library. This is the fourth project.
To get a local copy up and running, follow these steps.
In order to run this project you need:
Prerequisites: XAMPP application, including Apache web server, PHP (version 8), and MySQL DB server or MariaDB server. You can use a code editor like Visual Studio Code...
Clone the crud_add_phpmailer_jcmunav63 repo. You can clone this project inside of XAMPP's public folder called htdocs (in Windows C:\xampp\htdocs).
cd C:\xampp\htdocs
git clone https://github.com/PentaTech-IT-Solutions/crud_add_phpmailer_jcmunav63
This project requires the following dependencies: the PHP interpreter, the Apache Web Server, a MySQL or MariaDB database server, the dependency manager Composer, and the third-party libraries called domPDF and PHPMailer. The first three components are bundled into XAMPP application (for Windows or Linux). Other similar software applications are WAMP (for Windows), LAMP (for Linux), and MAMP (for Mac). The Composer, the domPDF, and the PHPMailer components are installed using a command terminal.
Create a database using the url "localhost/phpmyadmin" in the browser. The PHPMyAdmin application will open to manage the database server.
You can use the file database/team_management.sql using the import tab of the PHPMyAdmin application. It contains all the information to set up the database to start using it.
The SQL file will create the tables and it will insert some example data. Otherwise, you can also use PHPMyAdmin's graphic interface to create the database and the tables.
The suggested tables to use are...
- A users table (it will contain 6 columns, id, username, fullname, email, password, phonenumber).
- A teams table (it will contain 3 columns, id, name, description).
- A members table, (it will include 8 columns, id, teams_id, first_name, last_name, position, department, about, image_url).
To run the project, use the browser to enter the following path...
http://localhost/crud_add_phpmailer/index.php
In this home page you will find two links to enter the application, the signup.php form page, if you are not registered yet, or the login.php form page, if you are already registered. http://localhost/crud_add_phpmailer/signup.php
http://localhost/crud_add_phpmailer/login.php
See the images of these two forms below.
After logging in, the user is redirected to a Team members' Dashboard. Here, the user can Create, Read, Update, or Delete (CRUD) a team member.
Here's the form used to Create or Update a team member...
And there's also an option to create a new Team, using the following form. The Read, Update, or Delete operations for Teams are also implemented.
In the previous projects, we added the CRUD operations for the Team Members displayed on the dashboard page, and the generation of two PDF reports exported from the html content. The first report is the list of members displayed on the dashboard, and the second report is a specific details page, selected from the last name's link on the dashboard. The exported file is shown in the browser, as a pdf file, and it has a download or a print option for the user.
Here are some example images for these two reports...
- Members list page (dashboard):
- Member details page:
In this report, we added a link to each Team Members to generate an Email. It redirects to an html form where the Team Member's data is pre-loaded and it permits the user to add a SUBJECT, to change or leave today's DATE, and to add a MESSAGE. When the user clicks the send button, the Email is generated and sent using the PHPMailer library, together with an external API SMTP Email Service (MailTrap in my case). The Email is displayed using the HTML format, including a Logo, a Title (or heading), and the data coming from the form: subject, sender's name, sender's email, sender's department, date, and the message.
Here I show some images of the form and the resulting emails.
- Email form:
- Test Email received on MailTrap inbox:
👤 Juan Carlos Muñoz
- GitHub: @jcmunav63
- Twitter: @jcmunav63
- LinkedIn: @juan-carlos-muñoz
- I would like to acknowledge all the support and help from PentaTech-IT-Solutions.
This project is MIT licensed.