/qmail/db/messages/move

POST

Move an email from one folder to another.

POST /api/qmail/db/messages/move

Description

The /qmail/db/messages/move endpoint allows you to move an email between mailbox folders. This is useful for organizing emails, archiving messages, or implementing a trash/restore functionality.

Folder Management

Valid folder IDs are: 0 (inbox), 1 (sent), 2 (drafts), 3 (trash), 4 (starred), and 5 (archive).

Query Parameters

Parameter Type Required Description
email_id string Yes The unique email identifier (32-character hexadecimal string).
folder integer Yes The destination folder ID. 0=inbox, 1=sent, 2=drafts, 3=trash, 4=starred, 5=archive.

Response

Returns a JSON object confirming the move operation.

Response Properties

success boolean
Whether the operation succeeded.
message string
A brief status message.

Example Response

{
  "success": true,
  "message": "Email moved"
}

Try It Out

http://localhost:8081/api/qmail/db/messages/move?email_id={id}&folder={folder}

Examples

JavaScript

const API_BASE = 'http://localhost:8080/api';
const emailId = 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6';

async function moveEmail(emailId, folderId) {
    const response = await fetch(`${API_BASE}/qmail/db/messages/move?email_id=${emailId}&folder=${folderId}`, {
        method: 'POST'
    });
    return await response.json();
}

cURL

curl -X POST "http://localhost:8080/api/qmail/db/messages/move?email_id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6&folder=3"