{"id":15286173,"url":"https://github.com/msimerson/mail-dmarc","last_synced_at":"2026-02-27T05:20:17.986Z","repository":{"id":8257128,"uuid":"9706147","full_name":"msimerson/mail-dmarc","owner":"msimerson","description":"Mail::DMARC, a complete DMARC implementation in Perl","archived":false,"fork":false,"pushed_at":"2025-02-03T18:06:58.000Z","size":2911,"stargazers_count":35,"open_issues_count":6,"forks_count":23,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-02T12:12:50.370Z","etag":null,"topics":["dmarc","dmarc-reports","email","perl","smtp"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msimerson.png","metadata":{"files":{"readme":"README.md","changelog":"Changes.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"msimerson"}},"created_at":"2013-04-26T23:28:01.000Z","updated_at":"2025-02-03T18:06:58.000Z","dependencies_parsed_at":"2022-08-07T00:00:43.721Z","dependency_job_id":"250fd648-a5bf-4887-8537-2ef252b8b289","html_url":"https://github.com/msimerson/mail-dmarc","commit_stats":{"total_commits":682,"total_committers":20,"mean_commits":34.1,"dds":"0.21260997067448684","last_synced_commit":"ad52c4e64179aab27ef085de2bc009dc3b8147ee"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msimerson%2Fmail-dmarc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msimerson%2Fmail-dmarc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msimerson%2Fmail-dmarc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msimerson%2Fmail-dmarc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msimerson","download_url":"https://codeload.github.com/msimerson/mail-dmarc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dmarc","dmarc-reports","email","perl","smtp"],"created_at":"2024-09-30T15:10:51.685Z","updated_at":"2026-02-27T05:20:17.967Z","avatar_url":"https://github.com/msimerson.png","language":"Perl","funding_links":["https://github.com/sponsors/msimerson"],"categories":[],"sub_categories":[],"readme":"# Status Badges\n\n[![Build Status](https://github.com/msimerson/mail-dmarc/actions/workflows/ci.yml/badge.svg)](https://github.com/msimerson/mail-dmarc/actions/workflows/ci.yml)\n\n[![Coverage Status](https://coveralls.io/repos/msimerson/mail-dmarc/badge.svg)](https://coveralls.io/r/msimerson/mail-dmarc)\n\n# NAME\n\nMail::DMARC - Perl implementation of DMARC\n\n# VERSION\n\nversion 1.20260226\n\n# SYNOPSIS\n\nDMARC: Domain-based Message Authentication, Reporting and Conformance\n\n    my $dmarc = Mail::DMARC::PurePerl-\u003enew(\n      ... # see the documentation for the \"new\" method for required args\n    );\n\n    my $result = $dmarc-\u003evalidate();\n\n    if ( $result-\u003eresult eq 'pass' ) {\n       ...continue normal processing...\n       return;\n    };\n\n    # any result that did not pass is a fail. Now for disposition\n\n    if ( $result-\u003edisposition eq 'reject' ) {\n       ...treat the sender to a 550 ...\n    };\n    if ( $result-\u003edisposition eq 'quarantine' ) {\n       ...assign a bunch of spam points...\n    };\n    if ( $result-\u003edisposition eq 'none' ) {\n       ...continue normal processing...\n    };\n\n# DESCRIPTION\n\nThis module is a suite of tools for implementing DMARC. It adheres to the 2013 DMARC draft, intending to implement every MUST and every SHOULD.\n\nThis module can be used by...\n\n- MTAs and filtering tools like SpamAssassin to validate that incoming messages are aligned with the purported sender's policy.\n- email senders, to receive DMARC reports from other mail servers and display them via CLI and web interfaces.\n- MTA operators to send DMARC reports to DMARC author domains.\n\nWhen a message arrives via SMTP, the MTA or filtering application can pass in a small amount of metadata about the connection (envelope details, SPF and DKIM results) to Mail::DMARC. When the **validate** method is called, Mail::DMARC will determine if:\n\n    a. the header_from domain exists\n    b. the header_from domain publishes a DMARC policy\n    c. if a policy is published...\n    d. does the message conform to the published policy?\n    e. did the policy request reporting? If so, save details.\n\nThe validation results are returned as a [Mail::DMARC::Result](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AResult) object. If the author domain requested a report, it was saved to the [Report Store](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport%3A%3AStore). The Store class includes a SQL implementation that is tested with SQLite, MySQL and PostgreSQL.\n\nThere is more information available in the $result object. See [Mail::DMARC::Result](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AResult) for complete details.\n\nReports are viewed with the [dmarc\\_view\\_reports](http://search.cpan.org/perldoc?dmarc_view_reports) program or with a web browser and the [dmarc\\_httpd](http://search.cpan.org/perldoc?dmarc_httpd) program.\n\nAggregate reports are sent to their requestors with the [dmarc\\_send\\_reports](http://search.cpan.org/perldoc?dmarc_send_reports) program.\n\nFor aggregate reports that you have been sent, the [dmarc\\_receive](http://search.cpan.org/perldoc?dmarc_receive) program will parse the email messages (from IMAP, Mbox, or files) and save the report results into the [Report Store](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport%3A%3AStore).\n\nThe report store can use the same database to store reports you have received as well as reports you will send. There are several ways to identify the difference, including:\n\n- received reports will have a null value for report\\_policy\\_published.rua\n- outgoing reports will have null values for report.uuid and report\\_record.count\n\n# CLASSES\n\n[Mail::DMARC](http://search.cpan.org/perldoc?Mail%3A%3ADMARC) - the perl interface for DMARC\n\n[Mail::DMARC::Policy](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3APolicy) - a DMARC policy\n\n[Mail::DMARC::PurePerl](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3APurePerl) - Pure Perl implementation of DMARC\n\n[Mail::DMARC::Result](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AResult) - the results of applying policy\n\n[Mail::DMARC::Report](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport) - Reporting: the R in DMARC\n\n\u003e [Mail::DMARC::Report::Send](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport%3A%3ASend) - send reports via SMTP \u0026 HTTP\n\u003e\n\u003e [Mail::DMARC::Report::Receive](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport%3A%3AReceive) - receive and store reports from email, HTTP\n\u003e\n\u003e [Mail::DMARC::Report::Store](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport%3A%3AStore) - a persistent data store for aggregate reports\n\u003e\n\u003e [Mail::DMARC::Report::View](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3AReport%3A%3AView) - CLI and CGI methods for viewing reports\n\n[Mail::DMARC::libopendmarc](http://search.cpan.org/~shari/Mail-DMARC-opendmarc) - an XS implementation using libopendmarc\n\n# METHODS\n\n## new\n\nCreate a DMARC object.\n\n    my $dmarc = Mail::DMARC::PurePerl-\u003enew;\n\nPopulate it.\n\n    $dmarc-\u003esource_ip('192.0.1.1');\n    $dmarc-\u003eenvelope_to('recipient.example.com');\n    $dmarc-\u003eenvelope_from('sender.example.com');\n    $dmarc-\u003eheader_from('sender.example.com');\n    $dmarc-\u003edkim( $dkim_verifier );\n    $dmarc-\u003espf([\n        {   domain =\u003e 'example.com',\n            scope  =\u003e 'mfrom',\n            result =\u003e 'pass',\n        },\n        {\n            scope  =\u003e 'helo',\n            domain =\u003e 'mta.example.com',\n            result =\u003e 'fail',\n        },\n    ]);\n\nRun the request:\n\n    my $result = $dmarc-\u003evalidate();\n\nAlternatively, pass in all the required parameters in one shot:\n\n    my $dmarc = Mail::DMARC::PurePerl-\u003enew(\n            source_ip     =\u003e '192.0.1.1',\n            envelope_to   =\u003e 'example.com',\n            envelope_from =\u003e 'cars4you.info',\n            header_from   =\u003e 'yahoo.com',\n            dkim          =\u003e $dkim_results,  # same format\n            spf           =\u003e $spf_results,   # as previous example\n            );\n    my $result = $dmarc-\u003evalidate();\n\n## source\\_ip\n\nThe remote IP that attempted sending the message. DMARC only uses this data for reporting to domains that request DMARC reports.\n\n## envelope\\_to\n\nThe domain portion of the RFC5321.RcptTo, (aka, the envelope recipient), and the bold portion in the following example:\n\n\u003e RCPT TO:\u0026amp;lt;user@**example.com**\u003e\n\n## envelope\\_from\n\nThe domain portion of the RFC5321.MailFrom, (aka, the envelope sender). That is the the bold portion in the following example:\n\n\u003e MAIL FROM:\u0026amp;lt;user@**example.com**\u003e\n\n## header\\_from\n\nThe domain portion of the RFC5322.From, aka, the From message header.\n\n\u003e From: Ultimate Vacation \u0026amp;lt;sweepstakes@**example.com**\u003e\n\nYou can instead pass in the entire From: header with header\\_from\\_raw.\n\n## header\\_from\\_raw\n\nRetrieve the header\\_from domain by parsing it from a raw From field/header. The domain portion is extracted by [get\\_dom\\_from\\_header](http://search.cpan.org/perldoc?Mail%3A%3ADMARC%3A%3APurePerl%23get_dom_from_header), which is fast, generally effective, but also rather crude. It has limits, so read the description.\n\n## dkim\n\nIf Mail::DKIM::Verifier was used to validate the message, just pass in the Mail::DKIM::Verifier object that processed the message:\n\n    $dmarc-\u003edkim( $dkim_verifier );\n\nOtherwise, pass in an array reference. Each member of the DKIM array results represents a DKIM signature in the message and consists of the 4 keys shown in this example:\n\n    $dmarc-\u003edkim( [\n            {\n                domain      =\u003e 'example.com',\n                selector    =\u003e 'apr2013',\n                result      =\u003e 'fail',\n                human_result=\u003e 'fail (body has been altered)',\n            },\n            {\n                # 2nd signature, if present\n            },\n        ] );\n\nThe dkim results can also be build iteratively by passing in key value pairs or hash references for each signature in the message:\n\n    $dmarc-\u003edkim( domain =\u003e 'sig1.com', result =\u003e 'fail' );\n    $dmarc-\u003edkim( domain =\u003e 'sig2.com', result =\u003e 'pass' );\n    $dmarc-\u003edkim( { domain =\u003e 'example.com', result =\u003e 'neutral' } );\n\nEach hash or hashref is appended to the dkim array.\n\nFinally, you can pass a coderef which won't be called until the dkim method is used to read the dkim results.  It must return an array reference as described above.\n\nThe dkim result is an array reference.\n\n### domain\n\nThe d= parameter in the DKIM signature\n\n### selector\n\nThe s= parameter in the DKIM signature\n\n### result\n\nThe validation results of this signature. One of: none, pass, fail, policy, neutral, temperror, or permerror\n\n### human result\n\nAdditional information about the DKIM result. This is comparable to Mail::DKIM::Verifier-\u003eresult\\_detail.\n\n## spf\n\nThe spf method works exactly the same as dkim. It accepts named arguments, a hashref, an arrayref, or a coderef:\n\n    $dmarc-\u003espf(\n        domain =\u003e 'example.com',\n        scope  =\u003e 'mfrom',\n        result =\u003e 'pass',\n    );\n\nThe SPF domain and result are required for DMARC validation and the scope is used for reporting.\n\n### domain\n\nThe SPF checked domain\n\n### scope\n\nThe scope of the checked domain: mfrom, helo\n\n### result\n\nThe SPF result code: none, neutral, pass, fail, softfail, temperror, or permerror.\n\n# DESIGN \u0026 GOALS\n\n## Correct\n\nThe DMARC spec is lengthy and evolving, making correctness a moving target. In cases where correctness is ambiguous, options are generally provided.\n\n## Easy to use\n\nProviding an implementation of DMARC that SMTP utilities can utilize will aid DMARC adoption.\n\nThe list of dependencies appears long because of reporting. If this module is used without reporting, the number of dependencies not included with perl is about 5.\n\n## Maintainable\n\nSince DMARC is evolving, this implementation aims to be straight forward and easy to alter and extend. The programming style is primarily OO, which carries a small performance penalty but dividends in maintainability.\n\nWhen multiple options are available, such as when sending reports via SMTP or HTTP, calls should be made to the parent Send class to broker the request. When storing reports, calls are made to the Store class which dispatches to the SQL class. The idea is that if someone desired a data store other than those provided by perl's DBI class, they could easily implement their own. If you do, please fork it on GitHub and share.\n\n## Fast\n\nIf you deploy this in an environment where performance is insufficient, please profile the app and submit a report and preferably, patches.\n\n# SEE ALSO\n\n[Mail::DMARC on GitHub](https://github.com/msimerson/mail-dmarc)\n\n2015-03 [RFC 7489](https://tools.ietf.org/html/rfc7489)\n\nDMARC [Best Current Practices](http://tools.ietf.org/html/draft-crocker-dmarc-bcp-03)\n\n# HISTORY\n\nThe daddy of this perl module was a [DMARC module for the qpsmtpd MTA](https://github.com/smtpd/qpsmtpd/blob/master/plugins/dmarc).\n\n# AUTHORS\n\n- Matt Simerson \u003cmsimerson@cpan.org\u003e\n- Davide Migliavacca \u003cshari@cpan.org\u003e\n- Marc Bradshaw \u003cmarc@marcbradshaw.net\u003e\n\n# CONTRIBUTORS\n\n- Benny Pedersen \u003cme@junc.eu\u003e\n- Jean Paul Galea \u003cjeanpaul@yubico.com\u003e\n- Marisa Clardy \u003cmarisa@clardy.eu\u003e\n- Priyadi Iman Nurcahyo \u003cpriyadi@priyadi.net\u003e\n- Ricardo Signes \u003crjbs@cpan.org\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2026 by Matt Simerson.\n\nThis is free software; you can redistribute it and/or modify it under\nthe same terms as the Perl 5 programming language system itself.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsimerson%2Fmail-dmarc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsimerson%2Fmail-dmarc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsimerson%2Fmail-dmarc/lists"}