mail page imap connection mime 5 bis rest 10
This commit is contained in:
parent
2a607b20fd
commit
814ec3849b
@ -3,9 +3,16 @@ import Imap from 'imap';
|
|||||||
import { simpleParser } from 'mailparser';
|
import { simpleParser } from 'mailparser';
|
||||||
|
|
||||||
// IMAP configuration
|
// 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 = {
|
const imapConfig: Imap.Config = {
|
||||||
user: process.env.IMAP_USER as string,
|
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',
|
host: process.env.IMAP_HOST || 'mail.infomaniak.com',
|
||||||
port: parseInt(process.env.IMAP_PORT || '993', 10),
|
port: parseInt(process.env.IMAP_PORT || '993', 10),
|
||||||
tls: true,
|
tls: true,
|
||||||
@ -14,6 +21,10 @@ const imapConfig: Imap.Config = {
|
|||||||
|
|
||||||
// Validate IMAP configuration
|
// Validate IMAP configuration
|
||||||
if (!imapConfig.user || !imapConfig.password) {
|
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.');
|
throw new Error('IMAP credentials are not properly configured. Please check your .env file.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user