PHP Contact Form Send Email Add More File Attachment

Today, We want to share with you PHP Contact Form Send Email Add More File Attachment.
In this post we will show you PHP Contact Form with file Multiple attachment, hear for attach two or multiple files and send mail in PHP we will give you demo and example for implement.
In this post, we will learn about PHP Contact Form with Add More File Attachment Option with an example.

PHP Contact Form Send Email Add More File Attachment

There are the Following The simple About PHP Contact Form Send Email Add More File Attachment Full Information With Example and source code.and my previous POST learn To multiple image upload in php demo

Contact Form HTML with Attachment

Contact Form HTML with multiple Add More Attachment – index.php

<!DOCTYPE html>
<link href="yourdomainame/style.css" rel="stylesheet" type="text/css" />
<script src=""
<title>PHP Send Email Dynamically Add More Multiple File Attachment</title>

    <h1>PHP Send Email Dynamically Add More Multiple File Attachment</h1>

    <div class="pakainfo attachment-form-container">
        <form name="sendmailFrm" id="sendmailFrm" method="post" action=""
            onsubmit="return frmempvalidate()">

            <div class="input-row">
                <label style="padding-top: 20px;">Name</label> <span
                    id="employeeName-info" class="info"></span><br /> <input
                    type="text" class="input-field" name="employeeName"
                    id="employeeName" />
            <div class="input-row">
                <label>Email</label> <span id="employeeEmail-info"
                    class="info"></span><br /> <input type="text"
                    class="input-field" name="employeeEmail" id="employeeEmail" />
            <div class="input-row">
                <label>Subject</label> <span id="employeeSubject-info"
                    class="info"></span><br /> <input type="text"
                    class="input-field" name="employeeSubject" id="employeeSubject" />

<script src=""
<script type="text/javascript">
        function frmempvalidate() {
            var frmempvalid = true;

            var employeeName = document.forms["sendmailFrm"]["employeeName"].value;
            var employeeEmail = document.forms["sendmailFrm"]["employeeEmail"].value;
            var employeeSubject = document.forms["sendmailFrm"]["employeeSubject"].value;
            var employeeMessage = document.forms["sendmailFrm"]["employeeMessage"].value;
            if (employeeName == "") {
                $("#employeeName").css('background-color', '#3d3d3d');
                frmempvalid = false;
            if (employeeEmail == "") {
                $("#employeeEmail").css('background-color', '#3d3d3d');
                frmempvalid = false;
            if (!employeeEmail.match(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/))
                $("#employeeEmail").css('background-color', '#3d3d3d');
                frmempvalid = false;

            if (employeeSubject == "") {
                $("#employeeSubject").css('background-color', '#3d3d3d');
                frmempvalid = false;
            if (employeeMessage == "") {
                $("#employeeMessage").css('background-color', '#3d3d3d');
                frmempvalid = false;
            return frmempvalid;
        function multipleaddAttachment() {

PHP Mail Send with Multiple Attachments

PHP Mail Sending Script with Multiple Attachments

Also Read This 👉   how to send attachment in mail in php?

We used simple PHPMailer SMTP to multiple Files or images(Attachments) send the each employeeEmail contact form email by using pure goole product Gmail SMTP

if(!empty($_POST["send"])) {
    require_once ('phpmailer/class.phpmailer.php');
	//setting some smtp Mail
    $mail = new PHPMailer();
    $mail->SMTPDebug = 0;
    $mail->SMTPAuth = TRUE;
    $mail->Port = 587; // port set
    $mail->Username = "Set SMTP USERNAME([email protected])";
    $mail->Password = "Set SMTP PASSWORD(98982256245)";
    $mail->Mailer = "smtp";
    if (isset($_POST["employeeEmail"])) {
        $employeeEmail = $_POST["employeeEmail"];
    if (isset($_POST["employeeName"])) {
        $employeeName = $_POST["employeeName"];
    if (isset($_POST["employeeSubject"])) {
        $employeeSubject = $_POST["employeeSubject"];
    if (isset($_POST["employeeMessage"])) {
        $comments = $_POST["employeeMessage"];
    $mail->SetFrom($employeeEmail, $employeeName);
    $mail->AddReplyTo($employeeEmail, $employeeName);
    $mail->AddAddress("YOUR Google or any other RECIPIENT address of Email"); // set recipient email address
    $mail->Subject = $employeeSubject;
    $mail->WordWrap = 80;
    $mail->SMTPSecure = 'tls';
    $mail->Host = '';
    if (! empty($_FILES['attachment'])) {
        $total = count($_FILES['attachment']['name']);
        if ($total > 0) {
            // here Attaching two or more multiple images or files with the send email
            for ($attach = 0; $attach < $total; $attach ++) {
                if (! empty($_FILES["attachment"]["name"])) {
                    $tmpfl = $_FILES["attachment"]["tmp_name"][$attach];
                    $employeeFlname = $_FILES["attachment"]["name"][$attach];
                    $mail->AddAttachment($tmpfl, $employeeFlname);
    if (! $mail->Send()) {
        $message = "Problem in sending email";
        $type = "error";
    } else {
        $message = "Your Mail sent successfully, Good Luck";
        $type = "success";


Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Send Multiple Attachment In Email Using PHP.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.