PHPackages                             chinayin/phpmailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. chinayin/phpmailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

chinayin/phpmailer
==================

PHPMailer is a full-featured email creation and transfer class for PHP

6.0.7(7y ago)0102↓100%LGPL-2.1PHPPHP &gt;=5.5.0

Since Dec 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/chinayin/PHPMailer)[ Packagist](https://packagist.org/packages/chinayin/phpmailer)[ RSS](/packages/chinayin-phpmailer/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (7)Versions (42)Used By (0)

[![PHPMailer](https://camo.githubusercontent.com/9cb2da7fa70cc106ef21262c050af43fe6d16d9a3021418be24513c2fe0d7b00/68747470733a2f2f7261772e6769746875622e636f6d2f5048504d61696c65722f5048504d61696c65722f6d61737465722f6578616d706c65732f696d616765732f7068706d61696c65722e706e67)](https://camo.githubusercontent.com/9cb2da7fa70cc106ef21262c050af43fe6d16d9a3021418be24513c2fe0d7b00/68747470733a2f2f7261772e6769746875622e636f6d2f5048504d61696c65722f5048504d61696c65722f6d61737465722f6578616d706c65732f696d616765732f7068706d61696c65722e706e67)

PHPMailer - A full-featured email creation and transfer class for PHP
=====================================================================

[](#phpmailer---a-full-featured-email-creation-and-transfer-class-for-php)

Build status: [![Build Status](https://camo.githubusercontent.com/f4a0071af38710ae87f12af9fb4571f43042318a5978c9d40b13dc4db8c4e567/68747470733a2f2f7472617669732d63692e6f72672f5048504d61696c65722f5048504d61696c65722e737667)](https://travis-ci.org/PHPMailer/PHPMailer)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/689aaed6796eb861f94a0220afe455603f25f76bb50927ff48c7724821806fa7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5048504d61696c65722f5048504d61696c65722f6261646765732f7175616c6974792d73636f72652e706e673f733d33373538653231643237396265636466383437613535376135366133656431366466656339643564)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)[![Code Coverage](https://camo.githubusercontent.com/84c9b6c9bc4c027519a2f5af556ac30740e2921c6ca4aa8123f295f16c8fce41/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5048504d61696c65722f5048504d61696c65722f6261646765732f636f7665726167652e706e673f733d33666536636135666538636432636466393632383537353665343239333266376361323536393632)](https://scrutinizer-ci.com/g/PHPMailer/PHPMailer/)

[![Latest Stable Version](https://camo.githubusercontent.com/42469c87a88a5686f9b57421aa60313cab921fb98bc7210844a740c0dc357542/68747470733a2f2f706f7365722e707567782e6f72672f7068706d61696c65722f7068706d61696c65722f762f737461626c652e737667)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://camo.githubusercontent.com/aed476d48bf942e9a6ec22ddb0fe4e4423ce0fd2480bb0915b58cd49d2550926/68747470733a2f2f706f7365722e707567782e6f72672f7068706d61696c65722f7068706d61696c65722f646f776e6c6f616473)](https://packagist.org/packages/phpmailer/phpmailer) [![Latest Unstable Version](https://camo.githubusercontent.com/8aaa6977ab7891d5c6fa73c89a3b1a415b5713daffe622f9b5ace6e1ac2e4299/68747470733a2f2f706f7365722e707567782e6f72672f7068706d61696c65722f7068706d61696c65722f762f756e737461626c652e737667)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://camo.githubusercontent.com/52dd7d20e149fe9a53c83bc103afd57f494f38a2ae5c2f7dc8a634e1c3d2544a/68747470733a2f2f706f7365722e707567782e6f72672f7068706d61696c65722f7068706d61696c65722f6c6963656e73652e737667)](https://packagist.org/packages/phpmailer/phpmailer)

Class Features
--------------

[](#class-features)

- Probably the world's most popular code for sending email from PHP!
- Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more
- Integrated SMTP support - send without a local mail server
- Send emails with multiple To, CC, BCC and Reply-to addresses
- Multipart/alternative emails for mail clients that do not read HTML email
- Add attachments, including inline
- Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings
- SMTP authentication with LOGIN, PLAIN, CRAM-MD5 and XOAUTH2 mechanisms over SSL and SMTP+STARTTLS transports
- Validates email addresses automatically
- Protect against header injection attacks
- Error messages in over 50 languages!
- DKIM and S/MIME signing support
- Compatible with PHP 5.5 and later
- Namespaced to prevent name clashes
- Much more!

Why you might need it
---------------------

[](#why-you-might-need-it)

Many PHP developers utilize email in their code. The only PHP function that supports this is the `mail()` function. However, it does not provide any assistance for making use of popular features such as HTML-based emails and attachments.

Formatting email correctly is surprisingly difficult. There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong! *Please* don't be tempted to do it yourself - if you don't use PHPMailer, there are many other excellent libraries that you should look at before rolling your own - try [SwiftMailer](https://swiftmailer.symfony.com/), [Zend/Mail](https://zendframework.github.io/zend-mail/), [eZcomponents](https://github.com/zetacomponents/Mail) etc.

The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD and OS X platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP implementation allows email sending on Windows platforms without a local mail server.

License
-------

[](#license)

This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license. Please read LICENSE for information on the software availability and distribution.

Installation &amp; loading
--------------------------

[](#installation--loading)

PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file:

```
"phpmailer/phpmailer": "~6.0"
```

or run

```
composer require phpmailer/phpmailer
```

Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer; they are not part of PHPMailer.

If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`.

Alternatively, if you're not using Composer, copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually:

```
