PHPackages                             kynx/laminas-dkim - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. kynx/laminas-dkim

AbandonedLibrary[Mail &amp; Notifications](/categories/mail)

kynx/laminas-dkim
=================

DKIM Signer for Laminas Mail

2.0.0(3y ago)0119[6 PRs](https://github.com/kynx/laminas-dkim/pulls)MITPHPPHP ^7.4 || ~8.0.0 || ~8.1.0

Since Jul 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kynx/laminas-dkim)[ Packagist](https://packagist.org/packages/kynx/laminas-dkim)[ RSS](/packages/kynx-laminas-dkim/feed)WikiDiscussions 2.0.x Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (13)Used By (0)

kynx/laminas-dkim
=================

[](#kynxlaminas-dkim)

[![Build Status](https://github.com/kynx/laminas-dkim/workflows/Continuous%20Integration/badge.svg)](https://github.com/kynx/laminas-dkim/actions?query=workflow%3A%22Continuous+Integration%22)

Add DKIM signatures to [laminas-mail](https://docs.laminas.dev/laminas-mail/) messages.

[DKIM](https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail) signatures enable systems receiving your emails to verify that the email was sent was sent from who it says it was and hasn't been tampered with en-route. Adding them lessens the chance of ending up in someones spam folder.

If you are sending mail via SMTP you probably do not need this library: most reputable providers add them already. Check the full headers of an email your system has sent for a `DKIM-Signature` header. If it's there, find something else to do 😉

Before using this library, be sure you can add `TXT` records to the DNS of the domains you are sending mails `From`. You will need to add specially formatted `TXT` records to those domains or your signed messages will get rejected.

Installation
------------

[](#installation)

```
composer require kynx/laminas-dkim

```

If you are adding this to an existing Laminas or Mezzio project, you should be prompted to add the package as a module or to your `config/config.php`.

Next copy the configuration to your autoload directory:

```
cp vendor/kynx/laminas-dkim/config/dkim.global.php.dist config/autoload/dkim.global.php
cp vendor/kynx/laminas-dkim/config/dkim.local.php.dist config/autoload/dkim.local.php

```

The `dkim.local.php` file will contain the private key used to sign messages: **DO NOT** check it into version control!

Create a private signing key - as described at [dkimcore.org](http://dkimcore.org/specification.html) - and add it to the `dkim.local.php` file you copied above, *without* the surrounding `-----BEGIN RSA PRIVATE KEY-----` / `-----END RSA PRIVATE KEY-----`.

Finish the configuration by setting your `domain`, `selector` and the `headers` you want to sign in `dkim.global.php`.

You will now be able to sign messages. But you still will need to configure your DNS `TXT` record before receiving mail servers will be able to verify it: see [dkimcore.org](http://dkimcore.org/specification.html) for details on the format for that.

Usage
-----

[](#usage)

### Manual instantiation

[](#manual-instantiation)

```
