Send Multiple Attachments In Email Using PHP
Thursday, Sep 28, 2017
In this tutorial we will show you how to send multiple attachments in email using PHP and PHP Mailer Library. In this we send multiple images in email from our directory you send any file as email attachment. You may also like send beautiful emails using HTML and PHP.
To Send Multiple Attachments In Email It Takes Only One Step:-
- Make a PHP file to send mail with multiple attachments
Step 1.Make a PHP file to send mail with multiple attachments
We make a PHP file and save it with a name mail.php
<?php require_once('class.phpmailer.php'); $send_mail = new PHPMailer(); $send_mail->From =Sender Email; $send_mail->FromName = Name; $send_mail->Subject = Subject; $send_mail->Body = Message; $send_mail->AddAddress(Reciever Email); $attach_file1 = $folder."image1.jpg"; $attach_file2 = $folder."image2.jpg"; $attach_file3 = $folder."image3.jpg"; $send_mail->AddAttachment($attach_file1); $send_mail->AddAttachment($attach_file2); $send_mail->AddAttachment($attach_file3); $send_mail->Send(); ?>
In this step we add PHP Mailer Library and use PHPMailer object and then enter all the details and attach all the files we want to send as attachments in email. We choose images from our directory to send in email as attachments you can use any type of files.You may also like verify account on signup through email using PHP.
Thats all, this is how to send multiple attachments in email using PHP.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.
Hello, My Name is Mudit Jain. I am a Web Developer, Professional Blogger and Digital Marketer from India. I am the founder of TalkersCode. I started this blog in february 2015 to help web developers & bloggers by providing easy and best tutorials, articles and offers for web developers and bloggers.