Neah version mail remove mail correction 2 ?
This commit is contained in:
parent
54195c43b1
commit
f9ebf07855
@ -1,5 +1,4 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { cookies } from 'next/headers';
|
|
||||||
import { getImapClient } from '@/lib/imap';
|
import { getImapClient } from '@/lib/imap';
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
@ -33,7 +32,7 @@ export async function POST(request: Request) {
|
|||||||
const lock = await imap.getMailboxLock(folder);
|
const lock = await imap.getMailboxLock(folder);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// First, fetch all messages to get their UIDs
|
// Fetch messages to get their UIDs
|
||||||
const messages = await imap.fetch({
|
const messages = await imap.fetch({
|
||||||
seq: numericIds.map(id => id.toString()),
|
seq: numericIds.map(id => id.toString()),
|
||||||
uid: true,
|
uid: true,
|
||||||
@ -62,7 +61,6 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true });
|
return NextResponse.json({ success: true });
|
||||||
} finally {
|
} finally {
|
||||||
// Always release the mailbox lock
|
|
||||||
lock.release();
|
lock.release();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { cookies } from 'next/headers';
|
|
||||||
import { getImapClient } from '@/lib/imap';
|
import { getImapClient } from '@/lib/imap';
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
@ -33,7 +32,7 @@ export async function POST(request: Request) {
|
|||||||
const lock = await imap.getMailboxLock(folder);
|
const lock = await imap.getMailboxLock(folder);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Fetch the message to get its UID
|
// Fetch message to get its UID
|
||||||
const messages = await imap.fetch({
|
const messages = await imap.fetch({
|
||||||
seq: numericId.toString(),
|
seq: numericId.toString(),
|
||||||
uid: true,
|
uid: true,
|
||||||
@ -53,7 +52,6 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
return NextResponse.json({ success: true });
|
return NextResponse.json({ success: true });
|
||||||
} finally {
|
} finally {
|
||||||
// Always release the mailbox lock
|
|
||||||
lock.release();
|
lock.release();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user