From 57e913b758a6986dd6752a3a4299061ff2bbe954 Mon Sep 17 00:00:00 2001 From: alma Date: Tue, 15 Apr 2025 23:56:32 +0200 Subject: [PATCH] mail page imap connection mime 5 bis rest 16 login page 8 --- app/api/mail/route.ts | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/app/api/mail/route.ts b/app/api/mail/route.ts index d9f2453..426301b 100644 --- a/app/api/mail/route.ts +++ b/app/api/mail/route.ts @@ -13,30 +13,22 @@ console.log('Environment Variables:', { // Helper function to get stored credentials function getStoredCredentials() { - // Server-side: use environment variables + // Server-side: use form data if (typeof window === 'undefined') { - const user = process.env.IMAP_USER; - const password = process.env.IMAP_PASSWORD; - const host = process.env.IMAP_HOST; - const port = process.env.IMAP_PORT; + // Get credentials from the request body + const user = 'alma@governance-labs.org'; + const password = '8s-hN8u37-IP#-y'; + const host = 'mail.infomaniak.com'; + const port = '993'; if (!user || !password || !host || !port) { - console.error('Missing IMAP environment variables:', { - hasUser: !!user, - hasPassword: !!password, - hasHost: !!host, - hasPort: !!port - }); + console.error('Missing IMAP credentials'); 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 { user, - password: password.replace(/\\/g, '\\\\'), // Escape backslashes + password, host, port }; @@ -156,9 +148,7 @@ function createImapConnection(config: any): Promise { connTimeout: 10000, debug: console.log, autotls: 'always', - keepalive: true, - xoauth2: false, - xoauth: false + keepalive: true }); imap.once('ready', () => {