PHP code example of jv-conseil / dkim-php-mail-signature

1. Go to this page and download the library: Download jv-conseil/dkim-php-mail-signature library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jv-conseil / dkim-php-mail-signature example snippets



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


use JVconseil\DkimPhpMailSignature\DKIMsign ;
use JVconseil\DkimPhpMailSignature\DKIMconfig ;

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

// set: this calls __set()
$config->domain = "mynewdomain.name" ;

// get: this calls __get()
$config->domain ; // => "mynewdomain.name" ;

// 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() ;
json
"jv-conseil/dkim-php-mail-signature": "^1.0"
bash
php ~/vendor/bin/phpdoc -d ~/dkim-php-mail-signature/ -t ~/dkim-php-mail-signature/docs/