Add MSG to EML email conversion support (#367)

- Add new msgconvert converter using libemail-outlook-message-perl
- Support conversion from Outlook MSG files to standard EML format
- Add msgconvert to Docker dependencies and version checking
- Register msgconvert converter in main converter registry

Implements feature request #367 for email format conversion
This commit is contained in:
radhakrishnan 2025-07-24 20:58:53 +05:30 committed by Emrik Östling
parent f5f718a84a
commit 5ffb7f4a01
4 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,47 @@
import { execFile } from "node:child_process";
export const properties = {
from: {
email: ["msg"],
},
to: {
email: ["eml"],
},
};
export function convert(
filePath: string,
fileType: string,
convertTo: string,
targetPath: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
options?: unknown,
): Promise<string> {
return new Promise((resolve, reject) => {
if (fileType === "msg" && convertTo === "eml") {
// Convert MSG to EML using msgconvert
// msgconvert will output to the same directory as the input file with .eml extension
// We need to use --outfile to specify the target path
const args = ["--outfile", targetPath, filePath];
execFile("msgconvert", args, (error, stdout, stderr) => {
if (error) {
reject(`error: ${error}`);
return;
}
if (stdout) {
console.log(`stdout: ${stdout}`);
}
if (stderr) {
console.error(`stderr: ${stderr}`);
}
resolve("Done");
});
} else {
reject(`Unsupported conversion from ${fileType} to ${convertTo}. Only MSG to EML conversion is currently supported.`);
}
});
}