定制 mathsgod/eml2html 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mathsgod/eml2html

最新稳定版本:v1.0.0

Composer 安装命令:

composer require mathsgod/eml2html

包简介

Convert EML files to self-contained HTML with base64-embedded inline images

README 文档

README

A PHP library to convert EML files into self-contained HTML, with all inline images embedded as base64 data URIs.

Requirements

Installation

composer require mathsgod/eml2html

Usage

Convert from a file

use Eml2Html\Converter;

$converter = new Converter();
$html = $converter->convertFile('/path/to/email.eml');

file_put_contents('output.html', $html);

Convert from a string

use Eml2Html\Converter;

$converter = new Converter();
$eml = file_get_contents('/path/to/email.eml');
$html = $converter->convertString($eml);

How it works

  1. Parses the EML file using php-mime-mail-parser.
  2. Extracts the HTML body (Quoted-Printable and charset decoding handled automatically).
  3. Collects all inline attachments and maps each Content-ID to a base64 data URI.
  4. Replaces every cid: reference in the HTML (including the cid:<id> bracketed variant emitted by Microsoft Word/Outlook) with the corresponding data URI, producing a fully self-contained HTML file.

API

Converter::convertFile(string $path): string

Reads the EML file at $path and returns self-contained HTML.
Throws \InvalidArgumentException if the file cannot be read.

Converter::convertString(string $eml): string

Accepts raw EML content as a string and returns self-contained HTML.

License

MIT

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固