# Parse a DMARC record

Split a published DMARC TXT value into its tags.

Canonical: https://1loc.dev/email/parse-a-dmarc-record/
Version: 1.0.0
Runtime: JavaScript · Node.js 22 / modern browsers
Verification: Local fixtures; no external services
Updated: 2026-10-28

## Implementation

```javascript
function parseDmarc(record) { return Object.fromEntries(record.split(';').map(tag => tag.trim()).filter(Boolean).map(tag => [tag.slice(0, tag.indexOf('=')).trim().toLowerCase(), tag.slice(tag.indexOf('=') + 1).trim()])); }
```

## Input

```json
"v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com; adkim=s"
```

## Expected output

```json
{
  "v": "DMARC1",
  "p": "quarantine",
  "rua": "mailto:dmarc@example.com",
  "adkim": "s"
}
```

## Edge case

Input:
```json
"v=DMARC1;p=reject;"
```
Output:
```json
{
  "v": "DMARC1",
  "p": "reject"
}
```

## Limits

- Tag names are lowercased; values are kept as published. Unknown tags are returned, not validated.
- The lab requires v=DMARC1 as the first tag and = in every tag, as receivers discard other records (RFC 7489). Check that p is present: it is the policy receivers apply.

The lab validates types and size before calling this function. Add equivalent validation at your own trust boundary.

## Source and license

Author: Oveyon, written for this edition; not part of the original 1loc collection.
Copyright (c) 2026 Oveyon
License: MIT — https://1loc.dev/licenses/
Maintainer: Oveyon
