$to
$to :
DKIMmail class
// 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() ;
If this project helps you reduce time to develop, you can give me a cup of coffee ☕️ :-)
<?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") ;
}