\JVconseil\DkimPhpMailSignatureDKIMmail

DKIMmail class

Usage

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

// parameters
$mail->from    = "Sender" <sender@yourdomain.com> ;
$mail->to      = "Recipient" <recipient@yourdomain.com> ;
$mail->subject = "Your Mail Subject" ;
$mail->body    = "Your Mail Message." ;
$mail->attach("/path/to/your/attachment.jpg", "NameOfYourAttachment.jpg") ;

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

Sponsorship

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

Donate with PayPal

Examples

Send DKIM sign emails:

<?php
/**
 * Class example with config file accessed through a class.
 *
 * To test this example enter in Terminal this command line:
 * ```
 * php ~/dkim-php-mail-signature/examples/ClassMethod.php
 * ```
 *
 * @author JV conseil — Internet Consulting <contact@jv-conseil.net>
 * @see http://www.jv-conseil.net
 * @see https://github.com/JV-conseil-Internet-Consulting/dkim-php-mail-signature
 * @see https://packagist.org/packages/jv-conseil/dkim-php-mail-signature
 * @license EUPL-1.2 license, Copyright (c) 2019-2023 JV conseil – Internet Consulting, All rights reserved.
 * @version v1.2.5
 */


 /** Call Composer Package JVconseil\DkimPhpMailSignature */
require_once __DIR__ . '/../vendor/autoload.php' ; // Autoload files using Composer autoload

use JVconseil\DkimPhpMailSignature\DKIMmail ;

$mail = new DKIMmail(__DIR__ . '/../config/config.sample.inc.php') ;

// YOUR E-MAIL
$mail->to = '"Recipient" <recipient@' . $config->domain . '>' ;

$mail->from = '"Sender" <sender@' . $mail->config->domain . '>' ;

$mail->subject = 'DKIM e-mail test for domain ' . $mail->config->domain ;

$mail->body =
'<html>
	<header></header>
	<body>
		<p>Hello,</p>

		<p>This a <b>DKIM</b> e-mail test with an attachment.</p>

		<p>Cheers,<br>' . htmlspecialchars($mail->from) . '</p>
	</body>
</html>';

$mail->attach(__DIR__ . '/SendMail.attachment.sample.pdf', 'SendMail.attachment.sample.pdf') ;

try {
	if ($mail->send() == true) {
		// header('Content-Type: text/plain') ;
		echo $mail->signed_headers . $mail->headers . "\r\n" ;
		echo 'To: ' . $mail->to . "\r\n" ;
		echo 'Subject: ' . $mail->subject . "\r\n" ;
		echo $mail->body . "\r\n" ;
	}
} catch (Exception $e) {
    die('Caught exception: ' . $e->getMessage() . "\r\n") ;
}

Summary

Methods
Properties
Constants
__construct()
attach()
build_message()
build_multipart()
send()
$to
$from
$headers
$subject
$body
$is_html
$return_receipt
$parts
No constants found
No protected methods found
$_config_file
N/A
No private methods found
No private properties found
N/A

Properties

$to

$to : 

Type

$from

$from : 

Type

$headers

$headers : 

Type

$subject

$subject : 

Type

$body

$body : 

Type

$is_html

$is_html : 

Type

$return_receipt

$return_receipt : 

Type

$parts

$parts : 

Type

$_config_file

$_config_file : string

Type

string — store the path to your <config/config.inc.php> file

Methods

__construct()

__construct(  $_config_file) 

constructeur

Parameters

$_config_file

attach()

attach(  $message,   $name,   $ctype = '') 

Parameters

$message
$name
$ctype

build_message()

build_message(  $part,   $charset = 'UTF-8') 

Parameters

$part
$charset

build_multipart()

build_multipart(  $type = 'mixed',   $charset = 'UTF-8',   $boundary = '') 

Parameters

$type
$charset
$boundary

send()

send(string  $test = false) 

Send the mail

Parameters

string $test

= true : do not send the email but displays the command