Fix himalaya command: use 'smtp send' with --mail-from/--rcpt-to flags

This commit is contained in:
Dave 2026-08-17 20:31:53 +02:00
parent 660db975e4
commit 61c5830028
3 changed files with 11 additions and 3 deletions

View file

@ -218,7 +218,11 @@ ${pdfB64}\r
writeFileSync(emlPath, eml, "utf8");
try {
execSync(`himalaya -a dyfins --backend smtp email send < "${emlPath}"`, { timeout: 30 });
// Extract recipients from EML for himalaya smtp send
const emlContent = readFileSync(emlPath, "utf8");
const toMatch = emlContent.match(/^To:\s*(.+)$/m);
const toAddresses = toMatch ? toMatch[1].trim() : "";
execSync(`himalaya -a dyfins smtp send --mail-from SJ@Dyfins.com --rcpt-to "${toAddresses}" < "${emlPath}"`, { timeout: 30 });
} finally {
unlinkSync(emlPath);
}

View file

@ -222,7 +222,11 @@ ${body}\r
writeFileSync(emlPath, eml, "utf8");
try {
execSync(`himalaya -a dyfins --backend smtp email send < "${emlPath}"`, { timeout: 30 });
// Extract recipients from EML for himalaya smtp send
const emlContent = readFileSync(emlPath, "utf8");
const toMatch = emlContent.match(/^To:\s*(.+)$/m);
const toAddresses = toMatch ? toMatch[1].trim() : "";
execSync(`himalaya -a dyfins smtp send --mail-from SJ@Dyfins.com --rcpt-to "${toAddresses}" < "${emlPath}"`, { timeout: 30 });
} finally {
unlinkSync(emlPath);
if (pdfPath && pdfPath.length > 0) {

File diff suppressed because one or more lines are too long