mail page imap connection mime 5 bis rest 10

This commit is contained in:
alma 2025-04-15 23:08:04 +02:00
parent 2a607b20fd
commit 814ec3849b

View File

@ -3,9 +3,16 @@ import Imap from 'imap';
import { simpleParser } from 'mailparser';
// IMAP configuration
console.log('IMAP Configuration:', {
user: process.env.IMAP_USER,
host: process.env.IMAP_HOST,
port: process.env.IMAP_PORT,
hasPassword: !!process.env.IMAP_PASSWORD
});
const imapConfig: Imap.Config = {
user: process.env.IMAP_USER as string,
password: process.env.IMAP_PASSWORD as string,
password: encodeURIComponent(process.env.IMAP_PASSWORD as string),
host: process.env.IMAP_HOST || 'mail.infomaniak.com',
port: parseInt(process.env.IMAP_PORT || '993', 10),
tls: true,
@ -14,6 +21,10 @@ const imapConfig: Imap.Config = {
// Validate IMAP configuration
if (!imapConfig.user || !imapConfig.password) {
console.error('IMAP configuration error:', {
user: imapConfig.user,
hasPassword: !!imapConfig.password
});
throw new Error('IMAP credentials are not properly configured. Please check your .env file.');
}