PHPMailer 

 
 

Open Source PHP API for Email Processing

PHP library that allows to attach and send multiple files, compose and send email messages to multiple users via To, CC, BCC, and Reply-to addresses.

PHPMailer is an open source PHP email sending library that enables software developers to create applications for building and sending email messages with minimum effort and cost. It also provides support for making an SMTP connection with authentication as well as sending email messages using Gmail servers.

The library has provided the capability to send emails to multiple users via To, CC, BCC, and Reply-to addresses. It also allows users to encode email messages using UTF-8 content and 8bit, base64, binary, and quoted-printable encodings. It also enables users to attach and send multiple files with ease. 

The library has provided multiple methods for sending email messages. The library provides several important features for email management such as add attachments to an email message, automatic email validation, error handling in over 50 languages, S/MIME and DKIM signing support, Integrated SMTP support, protection from header injection attacks, and many more.

Previous Next

Getting Started with PHPMailer

The recommended way to install PHPMailer is via Composer, please use the following command for easy installation.

Install PHPMailer API via Composer 

composer require phpmailer/phpmailer 

Send Email Message via PHP API

Sending emails messages in PHP is a very common approach nowadays adopted by software developers. The PHPMailer library gives software developers the power to send email messages inside their own applications with a couple of PHP commands. The library also supports sending plaintext emails for non-HTML email clients. You can also send emails from a local webserver with ease.

Send Email Message to a List via PHP

The open source library PHPMailer is usually used to send an email message to mailing lists.  The library is very reliable and can send emails a message to a whole list of recipients proficiently. After setting up a PHPMailer instance using SMTP, they can connect to a MySQL database to retrieve a list of recipients. You can set your custom email messages as well as one particular one to all recipients.  You can also select some specific users from the list for sending emails.

Add Multiple Attachment to Email

It is often required to share multiple files among your team members or with the customers.  The PHPMailer is a very powerful library that gives software developers the capability to send emails with multiple attachments. It uses a very simple form that accepts a file upload and emails it. On the other hand, it is a little more complex form that allows uploading multiple files at once and sends all of them as attachments to an email.

Sending Email via Gmail

The open source library PHPMailer gives software developers the capability to send their email messages via Google’s Gmail service. To send emails via Gmail servers you need some more settings than normal SMTP settings.  It uses id & password authentication. You can use the IMAP commands to save messages to a folder.  You can also get a list of available folders or labels using an IMAP commands