mail page imap connection mime 5 bis rest 9
This commit is contained in:
parent
485ce9d624
commit
2a607b20fd
@ -3,15 +3,20 @@ import Imap from 'imap';
|
|||||||
import { simpleParser } from 'mailparser';
|
import { simpleParser } from 'mailparser';
|
||||||
|
|
||||||
// IMAP configuration
|
// IMAP configuration
|
||||||
const imapConfig = {
|
const imapConfig: Imap.Config = {
|
||||||
user: process.env.IMAP_USER || 'alma@governance-labs.org',
|
user: process.env.IMAP_USER as string,
|
||||||
password: process.env.IMAP_PASSWORD || '',
|
password: process.env.IMAP_PASSWORD as string,
|
||||||
host: 'mail.infomaniak.com',
|
host: process.env.IMAP_HOST || 'mail.infomaniak.com',
|
||||||
port: 993,
|
port: parseInt(process.env.IMAP_PORT || '993', 10),
|
||||||
tls: true,
|
tls: true,
|
||||||
tlsOptions: { rejectUnauthorized: false }
|
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 {
|
interface ImapMessage {
|
||||||
header: {
|
header: {
|
||||||
from?: string[];
|
from?: string[];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user