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






PHP Send Email Dynamically Add More Multiple File Attachment



    

PHP Send Email Dynamically Add More Multiple File Attachment






PHP Mail Send with Multiple Attachments

PHP Mail Sending Script with Multiple Attachments

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

IsSMTP();
    $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->MsgHTML($comments);
    
    $mail->IsHTML(true);
    
    $mail->SMTPSecure = 'tls';
    $mail->Host = 'smtp.gmail.com';
    
    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";
    }
}
php-contact-form-with-add-more-file-attachment-option-output
php-contact-form-with-add-more-file-attachment-option-output
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

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 Pakainfo.com 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.

Leave a Comment