{"id":17125240,"url":"https://github.com/baltpeter/mail2pdf","last_synced_at":"2025-08-22T05:07:24.984Z","repository":{"id":84343125,"uuid":"351152751","full_name":"baltpeter/mail2pdf","owner":"baltpeter","description":"Render emails stored as .eml files to PDF","archived":false,"fork":false,"pushed_at":"2024-08-13T08:15:14.000Z","size":68,"stargazers_count":6,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T22:49:42.365Z","etag":null,"topics":["email","eml","eml-files","pdf","pdf-generation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/baltpeter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2021-03-24T16:38:41.000Z","updated_at":"2025-06-16T08:00:28.000Z","dependencies_parsed_at":"2025-04-13T06:13:58.939Z","dependency_job_id":"2ab2e3b1-a05b-4e88-b58f-af51ae1c94c9","html_url":"https://github.com/baltpeter/mail2pdf","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"76761ca64e38142501a03596044496887056a2f2"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/baltpeter/mail2pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baltpeter%2Fmail2pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baltpeter%2Fmail2pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baltpeter%2Fmail2pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baltpeter%2Fmail2pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baltpeter","download_url":"https://codeload.github.com/baltpeter/mail2pdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baltpeter%2Fmail2pdf/sbom","scorecard":{"id":224798,"data":{"date":"2025-08-11","repo":{"name":"github.com/baltpeter/mail2pdf","commit":"441ccdc1a39fe754133faaab415f7cca39b7dcdf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"24 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-hwqf-gcqm-7353","Warn: Project is vulnerable to: GHSA-9h6g-pr28-7cqp","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-pq67-2wwv-3xjx","Warn: Project is vulnerable to: GHSA-8cj5-5rvv-wf4v","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T03:29:57.486Z","repository_id":84343125,"created_at":"2025-08-17T03:29:57.486Z","updated_at":"2025-08-17T03:29:57.486Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271588743,"owners_count":24785751,"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","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["email","eml","eml-files","pdf","pdf-generation"],"created_at":"2024-10-14T18:44:30.910Z","updated_at":"2025-08-22T05:07:24.956Z","avatar_url":"https://github.com/baltpeter.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mail2pdf\n\n\u003e Node.js library to render emails stored as .eml files to PDF.\n\n![An example email converted using mail2pdf. On the left, the .eml file is opened in Thunderbird, on the right, the result PDF is opened. The test email was created using Microsoft Outlook and contains complex formatting like tables and images. The conversion was successful.](https://static.bn.al/img/mail2pdf-screenshot.png)\n\nWith mail2pdf, you can convert emails stored as .eml files (as exported by Thunderbird, for example) to PDF files from Node.js. The goal is to produce an output that closely matches what an actual email program would export when using the \"Print to PDF\" feature. This can be useful for archival purposes, for example.\n\nTo produce the best possible output, mail2pdf deliberately relies on the rather heavy Puppeteer library which spawns an entire headless Chromium instance, instead of choosing another HTML to PDF solution implemented natively in JS.\n\nThe actual implementation is rather simple, it is mostly a thin wrapper around [Puppeteer](https://github.com/puppeteer/puppeteer/) and Nodemailer's [Mailparser](https://nodemailer.com/extras/mailparser/). The library supports internationalization and using different output templates. Currently, one template is provided that imitates Thunderbird's PDF output.\n\n## Installation\n\nYou can install mail2pdf using yarn or npm:\n\n```sh\nyarn add mail2pdf\n# or `npm i mail2pdf`\n```\n\n## Example usage\n\nTo demonstrate how to use mail2pdf, this code shows how to convert a [sample .eml file](https://static.bn.al/other/mail2pdf/sample.eml) to PDF. The email was sent using Microsoft Outlook and contains complex formatting like tables and images.\n\n```js\nimport mail2pdf from 'mail2pdf';\nimport { promises as fs } from 'fs';\n\n(async () =\u003e {\n  // Simply call the `mail2pdf()` function with the email (or\n  // emails as an array) you want to convert. You can also\n  // pass additional options, see below for details.\n  const pdf = await mail2pdf('sample.eml', { language: 'en' });\n  // The resulting PDF is returned as a `Buffer` that you can\n  // save to disk for example.\n  await fs.writeFile('sample.pdf', pdf);\n})();\n```\n\nYou can view the conversion result [here](https://static.bn.al/other/mail2pdf/sample.pdf).\n\n## API\n\nOnly a single function is provided with the following interface:\n\n### `mail2pdf(eml, options?)`\n\n**Parameters:**\n\n- `eml` - The email(s) in .eml format to process. You can provide a single email or multiple ones as an array. For\n  each one, either provide a file path as a string, which will then be read from the filesystem, or the\n  content of the .eml file as a `Buffer` or `Stream`.\n- `options` - An optional object with the following properties:\n    - `language` - The language to be used for the labels in the generated PDF (optional, defaults to `en`).\n    Currently, English (`en`) and German (`de`) are supported.\n    - `template_name` - The template to use (optional, defaults to `thunderbird`). Currently, only `thunderbird`\n    is supported which will generate output similar to Thunderbird’s “Print to PDF” feature.\n\n**returns:** `Promise\u003cBuffer | Buffer[]\u003e` - The generated PDF(s) contained in a `Buffer`. A single `Buffer` if you provided a single email for the `eml` parameter, or an array of `Buffer`s if you provided multiple ones. \n\n## License\n\nmail2pdf is licensed under the MIT license, see the [`LICENSE`](/LICENSE) file for details.\n\nIssues and pull requests are welcome! If you find an email that doesn't render correctly, please let me know. To help reproduce the problem, it would be great if you could attach the .eml file in question to the issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaltpeter%2Fmail2pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaltpeter%2Fmail2pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaltpeter%2Fmail2pdf/lists"}