PHPackages                             paragonie/gpg-mailer - 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. paragonie/gpg-mailer

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

paragonie/gpg-mailer
====================

Encrypt outbound emails with Crypt\_GPG

v0.6.1(4y ago)9524.2k↓36.4%15[3 PRs](https://github.com/paragonie/gpg-mailer/pulls)1MITPHPPHP ^7.2|^8

Since Jun 5Pushed 4y ago10 watchersCompare

[ Source](https://github.com/paragonie/gpg-mailer)[ Packagist](https://packagist.org/packages/paragonie/gpg-mailer)[ Docs](https://paragonie.com)[ RSS](/packages/paragonie-gpg-mailer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (10)Used By (1)

GPG-Mailer
==========

[](#gpg-mailer)

[![Build Status](https://camo.githubusercontent.com/abf86863646295578fc8b770496f82533a51c8b0271d1a7337477174e385cc42/68747470733a2f2f7472617669732d63692e6f72672f70617261676f6e69652f6770672d6d61696c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/paragonie/gpg-mailer)[![Latest Stable Version](https://camo.githubusercontent.com/08f70bbfd4c18b91bd8b7bf9cd8ceb06507c798453fb007fa4a3f14f091ca20c/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f6770672d6d61696c65722f762f737461626c65)](https://packagist.org/packages/paragonie/gpg-mailer)[![Latest Unstable Version](https://camo.githubusercontent.com/5dd44d25ed4ec87b88af37ed0d1e594615046fab20812ea33255767aa2afc422/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f6770672d6d61696c65722f762f756e737461626c65)](https://packagist.org/packages/paragonie/gpg-mailer)[![License](https://camo.githubusercontent.com/ccf7f566dd527bfa2a40da13d7366064dc80c3bbc909ef1c010936942cc3c9ea/68747470733a2f2f706f7365722e707567782e6f72672f70617261676f6e69652f6770672d6d61696c65722f6c6963656e7365)](https://packagist.org/packages/paragonie/gpg-mailer)[![Downloads](https://camo.githubusercontent.com/7e8f436cf68aaa2734544a91ba3ebf5b858e955a4d3e0841e18b9ffc5626708c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617261676f6e69652f6770672d6d61696c65722e737667)](https://packagist.org/packages/paragonie/gpg-mailer)

Send GPG-encrypted emails (using [zend-mail](https://github.com/zendframework/zend-mail)and [Crypt\_GPG](https://github.com/pear/Crypt_GPG)).

License: MIT

The GPG-Mailer API in a Nutshell
--------------------------------

[](#the-gpg-mailer-api-in-a-nutshell)

```
/**
 * Import a public key, return the fingerprint
 *
 * @param string $gpgKey An ASCII armored public key
 * @return string The GPG fingerprint for this key
 */
public function import(string $gpgKey): string;

/**
 * Get the public key corresponding to a fingerprint.
 *
 * @param string $fingerprint
 * @return string
 */
public function export(string $fingerprint): string;

/**
 * Encrypt then email a message
 *
 * @param Message $message    The message data
 * @param string $fingerprint Which public key fingerprint to use
 */
public function send(Message $message, string $fingerprint);

/**
 * Email a message without encrypting it.
 *
 * @param Message $message The message data
 * @param bool $force      Send even if we don't have a private key?
 */
public function sendUnencrypted(Message $message, bool $force = false);
```

Example: Encrypt Outbound Emails with Your GnuPG Public Key
-----------------------------------------------------------

[](#example-encrypt-outbound-emails-with-your-gnupg-public-key)

```
