mail page imap connection mime 5 bis rest 9

This commit is contained in:
alma 2025-04-15 23:06:19 +02:00
parent 485ce9d624
commit 2a607b20fd

View File

@ -3,15 +3,20 @@ import Imap from 'imap';
import { simpleParser } from 'mailparser';
// IMAP configuration
const imapConfig = {
user: process.env.IMAP_USER || 'alma@governance-labs.org',
password: process.env.IMAP_PASSWORD || '',
host: 'mail.infomaniak.com',
port: 993,
const imapConfig: Imap.Config = {
user: process.env.IMAP_USER as string,
password: process.env.IMAP_PASSWORD as string,
host: process.env.IMAP_HOST || 'mail.infomaniak.com',
port: parseInt(process.env.IMAP_PORT || '993', 10),
tls: true,
tlsOptions: { rejectUnauthorized: false }
};
// Validate IMAP configuration
if (!imapConfig.user || !imapConfig.password) {
throw new Error('IMAP credentials are not properly configured. Please check your .env file.');
}
interface ImapMessage {
header: {
from?: string[];