-
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
JV conseil edited this page Nov 19, 2019
·
6 revisions
📬 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() ;
🔏 Stand-alone DKIM class to sign your emails with a 2048 bit private key hashed with SHA-256 algorithm. 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) ;
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.