{"id":23291,"library":"authheaders","title":"authheaders","description":"A library wrapping email authentication header verification and generation, supporting DKIM, SPF, and DMARC. Current version 0.16.3, release cadence irregular with updates every few months.","status":"active","version":"0.16.3","language":"python","source_language":"en","source_url":"https://github.com/ValiMail/authentication-headers","tags":["email","authentication","dkim","spf","dmarc","headers"],"install":[{"cmd":"pip install authheaders","lang":"bash","label":"PyPI install"}],"dependencies":[{"reason":"Required for email authentication result parsing/generation","package":"authres","optional":false},{"reason":"DKIM signature verification/generation","package":"dkimpy","optional":false},{"reason":"Public suffix list for DMARC org domains","package":"publicsuffix2","optional":false},{"reason":"DNS lookups for SPF and DMARC","package":"dnspython","optional":false}],"imports":[{"note":"The old deep import path is no longer correct.","wrong":"from authheaders.authheaders import authentic_headers","symbol":"authentic_headers","correct":"from authheaders import authentic_headers"},{"note":"Common mistake: trying to import submodule directly.","wrong":"import authheaders.dkim","symbol":"dkim","correct":"from authheaders import dkim"},{"note":"Should import the function, not the submodule.","wrong":"import authheaders.spf","symbol":"spf","correct":"from authheaders import spf"}],"quickstart":{"code":"from authheaders import authentic_headers\n\n# Generate authentication-results header for a single email\nheaders = {'from': 'sender@example.com', 'to': 'recipient@example.com', 'subject': 'Test'}\nresult = authentic_headers(headers, '127.0.0.1', 'example.com', spf_timeout=5, dkim_timeout=5, dmarc_timeout=5)\nprint(result)\n","lang":"python","description":"Generates Authentication-Results headers for a message. Requires dict of email headers and connecting IP."},"warnings":[{"fix":"pip install publicsuffix2 and ensure authheaders >=0.13.0","message":"The 'publicsuffix' package is deprecated; use 'publicsuffix2' instead. authheaders switched in 0.13.0.","severity":"deprecated","affected_versions":"<0.13.0"},{"fix":"Use Python >=3.9 or pin to authheaders==0.16.0","message":"Removed 'importlib_resources' dependency in 0.16.1; now uses 'importlib.resources' (Python 3.9+). May break on Python 3.7/3.8.","severity":"breaking","affected_versions":">=0.16.1"},{"fix":"Ensure header keys are lowercase (e.g., 'from', 'to', 'subject')","message":"The 'authentic_headers' function expects headers as a dict with case-insensitive keys. Providing 'From' instead of 'from' can cause silent failures.","severity":"gotcha","affected_versions":"all"},{"fix":"from authheaders.errors import AuthError","message":"The library may raise 'authheaders.errors.AuthError' for various failures; catch it explicitly.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from authheaders import authentic_headers","cause":"Wrong import path; trying to import from wrong module.","error":"AttributeError: module 'authheaders' has no attribute 'authentic_headers'"},{"fix":"pip install authres","cause":"Missing dependency 'authres' (authentication-results package).","error":"ModuleNotFoundError: No module named 'authres'"},{"fix":"Use: from authheaders import dkim","cause":"The function 'dkim' is not directly exposed; you must import the submodule correctly.","error":"AttributeError: module 'authheaders' has no attribute 'dkim'"},{"fix":"Provide all required arguments: authentic_headers(headers, ip, mfrom, helo=None, ...)","cause":"Incorrect call signature; 'mfrom' parameter required for DKIM/SPF.","error":"TypeError: authentic_headers() missing 1 required positional argument: 'mfrom'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}