{"id":50338345,"url":"https://github.com/mathsgod/eml2html-php","last_synced_at":"2026-05-29T15:01:12.738Z","repository":{"id":351460950,"uuid":"1211086584","full_name":"mathsgod/eml2html-php","owner":"mathsgod","description":"Convert EML files to self-contained HTML with base64-embedded inline images","archived":false,"fork":false,"pushed_at":"2026-04-15T04:07:07.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-15T06:11:29.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/mathsgod.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-15T03:51:16.000Z","updated_at":"2026-04-15T04:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mathsgod/eml2html-php","commit_stats":null,"previous_names":["mathsgod/eml2html-php"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mathsgod/eml2html-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Feml2html-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Feml2html-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Feml2html-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Feml2html-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathsgod","download_url":"https://codeload.github.com/mathsgod/eml2html-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathsgod%2Feml2html-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33657690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"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":[],"created_at":"2026-05-29T15:01:11.604Z","updated_at":"2026-05-29T15:01:12.718Z","avatar_url":"https://github.com/mathsgod.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# eml2html-php\r\n\r\nA PHP library to convert EML files into self-contained HTML, with all inline images embedded as base64 data URIs.\r\n\r\n## Requirements\r\n\r\n- PHP 8.0+\r\n- [`ext-mailparse`](https://www.php.net/manual/en/book.mailparse.php) (`pecl install mailparse`)\r\n\r\n## Installation\r\n\r\n```bash\r\ncomposer require mathsgod/eml2html\r\n```\r\n\r\n## Usage\r\n\r\n### Convert from a file\r\n\r\n```php\r\nuse Eml2Html\\Converter;\r\n\r\n$converter = new Converter();\r\n$html = $converter-\u003econvertFile('/path/to/email.eml');\r\n\r\nfile_put_contents('output.html', $html);\r\n```\r\n\r\n### Convert from a string\r\n\r\n```php\r\nuse Eml2Html\\Converter;\r\n\r\n$converter = new Converter();\r\n$eml = file_get_contents('/path/to/email.eml');\r\n$html = $converter-\u003econvertString($eml);\r\n```\r\n\r\n## How it works\r\n\r\n1. Parses the EML file using [`php-mime-mail-parser`](https://github.com/php-mime-mail-parser/php-mime-mail-parser).\r\n2. Extracts the HTML body (Quoted-Printable and charset decoding handled automatically).\r\n3. Collects all inline attachments and maps each `Content-ID` to a base64 data URI.\r\n4. Replaces every `cid:` reference in the HTML (including the `cid:\u003cid\u003e` bracketed variant emitted by Microsoft Word/Outlook) with the corresponding data URI, producing a fully self-contained HTML file.\r\n\r\n## API\r\n\r\n### `Converter::convertFile(string $path): string`\r\n\r\nReads the EML file at `$path` and returns self-contained HTML.  \r\nThrows `\\InvalidArgumentException` if the file cannot be read.\r\n\r\n### `Converter::convertString(string $eml): string`\r\n\r\nAccepts raw EML content as a string and returns self-contained HTML.\r\n\r\n## License\r\n\r\nMIT\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathsgod%2Feml2html-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathsgod%2Feml2html-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathsgod%2Feml2html-php/lists"}