Skip to content
JV conseil edited this page Nov 19, 2019 · 6 revisions

Packagist Version Donate with PayPal License BSD 3-Clause Follow JV conseil – Internet Consulting on Twitter

🔏 Stand-alone DKIM class to sign your emails with a 2048 bit private key hashed with SHA-256 algorithm.

DkimPhpMailSignature

Usage

Sample lines to import into your mail code to start signing with DKIM:

require_once __DIR__ . '/../vendor/autoload.php' ; // Autoload files using Composer autoload
use JVconseil\DkimPhpMailSignature\DKIMsign ;
use JVconseil\DkimPhpMailSignature\DKIMconfig ;

// init
$config = new DKIMconfig('/www/inc/config/jv-conseil/dkim-php-mail-signature/config.inc.php') ;
$sign = new DKIMsign(
	$config->private_key,
	$config->passphrase,
	$config->domain,
	$config->selector
) ;

// sign
$signed_headers = $sign->get_signed_headers($to, $subject, $message, $headers) ;

// send email
mail($to, $subject, $message, $signed_headers.$headers) ;

Introducing DKIMmail class

📬 Stand-alone class to send DKIM signed emails with a 2048 bit private key hashed with SHA-256 algorithm.

// init
$mail = new DKIMmail('/www/inc/config/jv-conseil/dkim-php-mail-signature/config.inc.php') ;

// parameters
$mail->from    = "Sender" <[email protected]> ;
$mail->to      = "Recipient" <[email protected]> ;
$mail->subject = "Your Mail Subject" ;
$mail->body    = "Your Mail Message." ;
$mail->attach("/path/to/your/attachment.jpg", "NameOfYourAttachment.jpg") ;

// send!
$mail->send() ;

Documentation

Documentation is available online, though it may not be quite up to date or match your version exactly.

You can generate API documentation by running phpdoc in the top-level folder of this project, and documentation will be generated in this folder:

php ~/vendor/bin/phpdoc -d ~/dkim-php-mail-signature/ -t ~/dkim-php-mail-signature/docs/

You will need to have phpDocumentor installed.

Sponsorship

If this project helps you reduce time to develop, you can give me a cup of coffee ☕️ :-)

Donate with PayPal

Clone this wiki locally