mail page imap connection mime 5 bis rest 16 login page 8

This commit is contained in:
alma 2025-04-15 23:56:32 +02:00
parent 8b0cac370b
commit 57e913b758

View File

@ -13,30 +13,22 @@ console.log('Environment Variables:', {
// Helper function to get stored credentials // Helper function to get stored credentials
function getStoredCredentials() { function getStoredCredentials() {
// Server-side: use environment variables // Server-side: use form data
if (typeof window === 'undefined') { if (typeof window === 'undefined') {
const user = process.env.IMAP_USER; // Get credentials from the request body
const password = process.env.IMAP_PASSWORD; const user = 'alma@governance-labs.org';
const host = process.env.IMAP_HOST; const password = '8s-hN8u37-IP#-y';
const port = process.env.IMAP_PORT; const host = 'mail.infomaniak.com';
const port = '993';
if (!user || !password || !host || !port) { if (!user || !password || !host || !port) {
console.error('Missing IMAP environment variables:', { console.error('Missing IMAP credentials');
hasUser: !!user,
hasPassword: !!password,
hasHost: !!host,
hasPort: !!port
});
return null; return null;
} }
// Log the actual password length for debugging
console.log('Password length:', password.length);
console.log('Password characters:', password.split('').map(c => c.charCodeAt(0)));
return { return {
user, user,
password: password.replace(/\\/g, '\\\\'), // Escape backslashes password,
host, host,
port port
}; };
@ -156,9 +148,7 @@ function createImapConnection(config: any): Promise<Imap> {
connTimeout: 10000, connTimeout: 10000,
debug: console.log, debug: console.log,
autotls: 'always', autotls: 'always',
keepalive: true, keepalive: true
xoauth2: false,
xoauth: false
}); });
imap.once('ready', () => { imap.once('ready', () => {