paragonie / Gpg Mailer
Licence: mit
GnuPG-encrypted emails made easy
Stars: ✭ 93
Projects that are alternatives of or similar to Gpg Mailer
Swiftmailer
Comprehensive mailing tools for PHP
Stars: ✭ 9,503 (+10118.28%)
Mutual labels: mailer, emails
Iostreams
IOStreams is an incredibly powerful streaming library that makes changes to file formats, compression, encryption, or storage mechanism transparent to the application.
Stars: ✭ 84 (-9.68%)
Mutual labels: gnupg
Email Spec
Collection of RSpec/MiniTest matchers and Cucumber steps for testing email in a ruby app using ActionMailer or Pony
Stars: ✭ 1,142 (+1127.96%)
Mutual labels: mailer
Sendgrid Mailer
Provides Sendgrid integration for Symfony Mailer
Stars: ✭ 24 (-74.19%)
Mutual labels: mailer
Simplyemail
Email recon made fast and easy, with a framework to build on
Stars: ✭ 779 (+737.63%)
Mutual labels: emails
Secret
send a message through a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever.
Stars: ✭ 83 (-10.75%)
Mutual labels: encrypted
Mailgun Mailer
Provides Mailgun integration for Symfony Mailer
Stars: ✭ 41 (-55.91%)
Mutual labels: mailer
Pentydesktopassistant
Penty is a small Desktop Assistant programmed with JS and Python as its backend and HTML and CSS as its front. Took just over a month to create v1.0. It has a few features, like an in-built gMail sender and a quick-open browser.
Stars: ✭ 80 (-13.98%)
Mutual labels: mailer
Peergos
A p2p, secure file storage, social network and application protocol
Stars: ✭ 895 (+862.37%)
Mutual labels: encrypted
Jaromail
A commandline tool to easily and privately handle your e-mail
Stars: ✭ 86 (-7.53%)
Mutual labels: gnupg
Inlets Operator
Add public LoadBalancers to your local Kubernetes clusters
Stars: ✭ 795 (+754.84%)
Mutual labels: encrypted
Rems For Organisations
Resources and Event Management System for small organisations and clubs. Mailers, Certificate Generation and much more 🎓🔗
Stars: ✭ 41 (-55.91%)
Mutual labels: mailer
Dat Keyserver
a distributed PGP keyserver project based on the dat protocol
Stars: ✭ 89 (-4.3%)
Mutual labels: gnupg
GPG-Mailer
Send GPG-encrypted emails (using zend-mail and Crypt_GPG).
License: MIT
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
<?php
use \ParagonIE\GPGMailer\GPGMailer;
use \Zend\Mail\Message;
use \Zend\Mail\Transport\Sendmail;
// First, create a Zend\Mail message as usual:
$message = new Message;
$message->addTo('[email protected]', 'Test Email');
$message->setBody('Cleartext for now. Do not worry; this gets encrypted.');
// Instantiate GPGMailer:
$gpgMailer = new GPGMailer(
new Sendmail(),
['homedir' => '/homedir/containing/keyring']
);
// GPG public key for <[email protected]> (fingerprint):
$fingerprint = '7F52D5C61D1255C731362E826B97A1C2826404DA';
// Finally:
$gpgMailer->send($message, $fingerprint);
If you're encrypting with a user provided public key (and they didn't tell you their fingerprint), do this instead:
<?php
/**
* Output from: gpg --armor --export [email protected]
*
* This is our security team's GPG public key. You probably don't
* want to use ours, as only we can decrypt the messages.
*
* @var string
*/
$ASCIIArmoredPublicKey = "-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.5
mQENBFUgwRUBCADcIpqNwyYc5UmY/tpx1sF/rQ3knR1YNXYZThzFV+Gmqhp1fDH5qBs9foh1
xwI6O7knWmQngnf/nBumI3x6xj7PuOdEZUh2FwCG/VWnglW8rKmoHzHAivjiu9SLnPIPAgHS
Heh2XD7q3Ndm3nenbjAiRFNl2iXcwA2cTQp9Mmfw9vVcw0G0z1o0G3s8cC8ZS6flFySIervv
fSRWj7A1acI5eE3+AH/qXJRd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Mailer->import($ASCIIArmoredPublicKey);
Sign Emails with the Server's Private Key
Signed and Encrypted
To add signing, we pass the signing key to the third argument of the GPGMailer constructor.
<?php
use \ParagonIE\GPGMailer\GPGMailer;
use \Zend\Mail\Message;
use \Zend\Mail\Transport\Sendmail;
// First, create a Zend\Mail message as usual:
$message = new Message;
$message->addTo('[email protected]', 'Test Email');
$message->setBody('Cleartext for now. Do not worry; this gets encrypted.');
$signingKey = file_get_contents('tests/private.key');
// Instantiate GPGMailer:
$gpgMailer = new GPGMailer(
new Sendmail(),
['homedir' => '/homedir/containing/keyring'],
$signingKey
);
// GPG public key for <[email protected]> (fingerprint):
$fingerprint = '7F52D5C61D1255C731362E826B97A1C2826404DA';
// Finally:
$gpgMailer->send($message, $fingerprint);
Alternatively, we could define our constructor as above but then use
setPrivateKey()
like so:
$gpgMailer = new GPGMailer(
new Sendmail(),
['homedir' => '/homedir/containing/keyring']
);
$signingKey = file_get_contents('tests/private.key');
$gpgMailer->setPrivateKey($signingKey);
Signed, But Not Encrypted
Same as above, except we don't need to load the recipient's fingerprint
and we use the sendUnencrypted()
method instead.
<?php
use \ParagonIE\GPGMailer\GPGMailer;
use \Zend\Mail\Message;
use \Zend\Mail\Transport\Sendmail;
// First, create a Zend\Mail message as usual:
$message = new Message;
$message->addTo('[email protected]', 'Test Email');
$message->setBody('Cleartext for now. Do not worry; this gets encrypted.');
$signingKey = file_get_contents('tests/private.key');
$gpgMailer = new GPGMailer(
new Sendmail(),
['homedir' => '/homedir/containing/keyring'],
$signingKey
);
$gpgMailer->sendUnencrypted($message);
Support Contracts
If your company uses this library in their products or services, you may be interested in purchasing a support contract from Paragon Initiative Enterprises.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].