mail page imap connection mime 5 bis rest 13
This commit is contained in:
parent
92b6eb8816
commit
133dafe8c4
@ -23,7 +23,8 @@ const imapConfig: Imap.Config = {
|
||||
servername: process.env.IMAP_HOST || 'mail.infomaniak.com'
|
||||
},
|
||||
authTimeout: 10000,
|
||||
connTimeout: 10000
|
||||
connTimeout: 10000,
|
||||
debug: console.log // Enable IMAP debug logging
|
||||
};
|
||||
|
||||
// Debug logging for IMAP configuration
|
||||
@ -60,9 +61,22 @@ interface ImapMessage {
|
||||
};
|
||||
}
|
||||
|
||||
interface ImapError extends Error {
|
||||
type?: string;
|
||||
textCode?: string;
|
||||
source?: string;
|
||||
}
|
||||
|
||||
// Helper function to create a promise-based IMAP connection
|
||||
function createImapConnection() {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log('Creating new IMAP connection with config:', {
|
||||
user: imapConfig.user,
|
||||
host: imapConfig.host,
|
||||
port: imapConfig.port,
|
||||
tls: imapConfig.tls
|
||||
});
|
||||
|
||||
const imap = new Imap(imapConfig);
|
||||
|
||||
imap.once('ready', () => {
|
||||
@ -70,8 +84,13 @@ function createImapConnection() {
|
||||
resolve(imap);
|
||||
});
|
||||
|
||||
imap.once('error', (err: Error) => {
|
||||
imap.once('error', (err: ImapError) => {
|
||||
console.error('IMAP connection error:', err);
|
||||
console.error('Error details:', {
|
||||
type: err.type,
|
||||
textCode: err.textCode,
|
||||
source: err.source
|
||||
});
|
||||
reject(err);
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user