PHPackages                             cracksalad/phpmailer-pgp - 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. cracksalad/phpmailer-pgp

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

cracksalad/phpmailer-pgp
========================

PHPMailerPGP enables PHPMailer to send OpenPGP/GPG encrypted and signed e-mails

3.0.0(6mo ago)14.5k↓33.3%LGPL-2.1-onlyPHPPHP &gt;=5.5.0CI passing

Since Apr 24Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/cracksalad/PHPMailer-PGP)[ Packagist](https://packagist.org/packages/cracksalad/phpmailer-pgp)[ RSS](/packages/cracksalad-phpmailer-pgp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (11)Used By (0)

PHPMailerPGP - A full-featured email creation and transfer class for PHP with support for PGP/GPG email signing and encryption.
===============================================================================================================================

[](#phpmailerpgp---a-full-featured-email-creation-and-transfer-class-for-php-with-support-for-pgpgpg-email-signing-and-encryption)

[![Latest Stable Version](https://camo.githubusercontent.com/b1587061dd8e2ec1b94c7cf251fd06a11e18b970deee6a5750451cb91c722d82/68747470733a2f2f706f7365722e707567782e6f72672f637261636b73616c61642f7068706d61696c65722d7067702f76)](https://packagist.org/packages/cracksalad/phpmailer-pgp)[![Total Downloads](https://camo.githubusercontent.com/7a50be20c78185f3c29ad1dac58cb90361e5b9b380cd1255bfbb28893b814261/68747470733a2f2f706f7365722e707567782e6f72672f637261636b73616c61642f7068706d61696c65722d7067702f646f776e6c6f616473)](https://packagist.org/packages/cracksalad/phpmailer-pgp)[![License](https://camo.githubusercontent.com/79fd803a7ccd606dc1f1bda27e07fd6eeac97ef83b051f656088c292316eda7d/68747470733a2f2f706f7365722e707567782e6f72672f637261636b73616c61642f7068706d61696c65722d7067702f6c6963656e7365)](https://packagist.org/packages/cracksalad/phpmailer-pgp)[![PHP Version Require](https://camo.githubusercontent.com/7c0906b688fd08353552991f3aeae094fa742747de54524b4efe8a938b32c014/68747470733a2f2f706f7365722e707567782e6f72672f637261636b73616c61642f7068706d61696c65722d7067702f726571756972652f706870)](https://packagist.org/packages/cracksalad/phpmailer-pgp)[![Psalm Type Coverage](https://camo.githubusercontent.com/a748217fe68607d80096cb6be195860fa618c2d60e7e20b611169b1b18fd0d79/68747470733a2f2f73686570686572642e6465762f6769746875622f637261636b73616c61642f5048504d61696c65725047502f636f7665726167652e737667)](https://packagist.org/packages/cracksalad/phpmailer-pgp)[![codecov](https://camo.githubusercontent.com/11fe38f6c47a9bd3137343685cffda61d2a24e66dd1593d6df04904204bc3ced/68747470733a2f2f636f6465636f762e696f2f67682f637261636b73616c61642f5048504d61696c65722d5047502f67726170682f62616467652e7376673f746f6b656e3d4654564a323844304654)](https://codecov.io/gh/cracksalad/PHPMailer-PGP)

This project is based on [ravisorg/PHPMailer](https://github.com/ravisorg/PHPMailer) and replaced PHPMailer inside the repository with PHPMailer as a dependency. It also adds Composer support and includes minor changes to the code itself.

See the main [PHPMailer](https://www.github.com/PHPMailer/PHPMailer) page for all the features PHPMailer supports. This page will document only the PGP additions.

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

[](#class-features)

- Uses the [PHP GnuPG extension](https://secure.php.net/manual/en/ref.gnupg.php) for encryption / signing
- Encrypt and/or sign outgoing emails with PGP to one or multiple recipients (signs first, then encrypts when both are enabled)
- Automatically selects the proper keys based on sender / recipients (or manually specify them)
- Use keys in the GPG keychain or from a specified file
- Supports file attachments (and encrypts/signs them)
- Builds PGP/MIME emails so that attachments are encrypted (and signed) as well as the email bodies
- Supports optional [Memory Hole protected email headers](https://github.com/autocrypt/memoryhole) (for verified/encrypted subjects, and verified from, to, and cc recipients)
- Uses standard PHPMailer functions so that, in theory, any email you can create with PHPMailer can be encrypted/signed with PHPMailerPGP
- Adheres to PHPMailer's coding standards
- (Mostly) built generically so that other encryption systems (S/MIME) could use the same syntax in their classes

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

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

In an ideal world, users would provide you with their PGP keys and you could use this to send secure emails to them. More realistically: because your server sends emails with lots of sensitive information in them, and you should be encrypting them.

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
------------

[](#installation)

Add this package to your composer.json like this:

```
composer require cracksalad/phpmailer-pgp
```

### Dependencies

[](#dependencies)

- gnupg/gnupg2
- [PHP's PECL extension for gnupg](https://pecl.php.net/package/gnupg)
- PHP 5.5+

A Simple Example
----------------

[](#a-simple-example)

Set up your PHPMailer like you would normally:

```
