mail

mail maintains an IMAP session for mailbox diagnostics, reads and saves messages, marks mail for deletion, and sends test messages through the local PHP mail transport.

NetworkVersion 1.1.5Stable
lil-terminal

Overview

Use mail to test incoming and outgoing mail as separate paths. IMAP covers connection, mailbox selection and reading; mail send tests the hosting account’s local PHP mail transport and does not reuse the IMAP connection.

Incoming and outgoing mail are separate paths

The IMAP password is entered through the hidden prompt and connection state is kept in the session. mail del only marks a message; mail expunge performs the permanent removal. A working IMAP login does not prove that PHP mail can send, and successful sending does not prove IMAP access.

Syntax

lil-terminal
mail [subcommand] [arguments] [options]

Reference

mail

show the current IMAP connection

mail connect <host> <user> [box]

connect through a hidden password prompt

mail boxes

list available mailboxes

mail box <name>

select a mailbox

mail ls [n] [-u]

list recent messages; optionally unread only

mail read <id> [-o <file>]

read a message or save it to a file

mail send <to> <subject> <text>

send diagnostic mail through the local PHP transport

-p <port>

set the IMAP port

-ssl | -tls | -plain

select the IMAP transport

-k

allow an unverified TLS certificate for diagnostics

-f

replace an existing message output file

-from <addr> | -cc <addr> | -bcc <addr> | -reply <addr>

set optional message headers

mail del <id> | mail undel <id>

mark a message deleted | undo the mark

mail expunge

permanently remove messages marked deleted

mail -e

disconnect and remove saved mail credentials

Notes

-k disables certificate verification and should be used only for diagnostics.

Safety

Passwords use the shared hidden prompt. Optional mail headers are validated before PHP mail is called. -k disables certificate verification and is intended only for diagnostics.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Show the current IMAP connection

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install mail
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install mail -m
Exact public version

Install exactly this published version.

install mail -v 1.1.5
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade mail
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install mail -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Show the current IMAP connection
mail
Offline training example — no live HTTP, mail or TLS request
Status    connected
Host      imap.example.test:993/ssl
User      user@example.test
Box       INBOX
Messages  12
Recent    1
Unread    3
Connect through a hidden password prompt
mail connect imap.example.test user@example.test
Offline training example — no live HTTP, mail or TLS request
Hidden password prompt opened
Connect through a hidden password prompt
mail connect imap.example.test user@example.test INBOX -ssl -p 993
Offline training example — no live HTTP, mail or TLS request
Hidden password prompt opened
Connect through a hidden password prompt
mail connect imap.example.test user@example.test INBOX -tls -p 143
Offline training example — no live HTTP, mail or TLS request
Hidden password prompt opened
Connect through a hidden password prompt
mail connect imap.example.test user@example.test INBOX -plain -p 143
Offline training example — no live HTTP, mail or TLS request
Hidden password prompt opened
Connect through a hidden password prompt
mail connect imap.example.test user@example.test INBOX -k
Offline training example — no live HTTP, mail or TLS request
Hidden password prompt opened
List available mailboxes
mail boxes
Offline training example — no live HTTP, mail or TLS request
INBOX
Archive
Sent
Select a mailbox
mail box Archive
Offline training example — no live HTTP, mail or TLS request
Status    connected
Host      imap.example.test:993/ssl
User      user@example.test
Box       Archive
Messages  7
Recent    0
Unread    1
List recent messages; optionally unread only
mail ls
Offline training example — no live HTTP, mail or TLS request
*3    2026-10-31 10:05    contact@example.test    Project update
 2    2026-10-30 09:20    alerts@example.test     Backup complete
List recent messages; optionally unread only
mail ls 10
Offline training example — no live HTTP, mail or TLS request
*3    2026-10-31 10:05    contact@example.test    Project update
 2    2026-10-30 09:20    alerts@example.test     Backup complete
List recent messages; optionally unread only
mail ls 10 -u
Offline training example — no live HTTP, mail or TLS request
*3    2026-10-31 10:05    contact@example.test    Project update
Read a message or save it to a file
mail read 3
Offline training example — no live HTTP, mail or TLS request
ID:      3
Date:    Sat, 31 Oct 2026 10:05:00 +0000
From:    contact@example.test
To:      user@example.test
Subject: Project update

The files are ready for review.
Read a message or save it to a file
mail read 3 -o tmp/message.txt
Offline training example — no live HTTP, mail or TLS request
Saved  sandbox/tmp/message.txt

README.txt
message.txt
Read a message or save it to a file
mail read 3 -o tmp/message.txt -f
Offline training example — no live HTTP, mail or TLS request
Saved  sandbox/tmp/message.txt

README.txt
message.txt
Mark a message deleted | undo the mark
mail del 3
Offline training example — no live HTTP, mail or TLS request
+
Reject an invalid recipient address
mail undel 3
Offline training example — no live HTTP, mail or TLS request
+
Permanently remove messages marked deleted
mail expunge
Offline training example — no live HTTP, mail or TLS request
+
Disconnect and remove saved mail credentials
mail -e
Offline training example — no live HTTP, mail or TLS request
+
Send diagnostic mail through the local PHP transport
mail send someone@example.test "Test" "Hello from lil"
Offline training example — no live HTTP, mail or TLS request
Mail accepted by local transport
(Note: this does not confirm delivery)
Send diagnostic mail through the local PHP transport
mail send someone@example.test "Test" "Hello" -from admin@example.test
Offline training example — no live HTTP, mail or TLS request
Mail accepted by local transport
(Note: this does not confirm delivery)
Send diagnostic mail through the local PHP transport
mail send someone@example.test "Test" "Hello" -cc team@example.test -bcc archive@example.test -reply admin@example.test
Offline training example — no live HTTP, mail or TLS request
Mail accepted by local transport
(Note: this does not confirm delivery)
Send diagnostic mail through the local PHP transport
mail send not-an-email "Test" "Hello"
Offline training example — no live HTTP, mail or TLS request
Invalid recipient address
Send diagnostic mail through the local PHP transport
mail send someone@example.test "A B" "Hello"
Offline training example — no live HTTP, mail or TLS request
Mail accepted by local transport
(Note: this does not confirm delivery)
Read a message or save it to a file
mail read bad-id
Offline training example — no live HTTP, mail or TLS request
Valid message ID required
Connect through a hidden password prompt
mail connect imap.example.test user@example.test INBOX -p 70000
Offline training example — no live HTTP, mail or TLS request
Invalid IMAP port
Connect through a hidden password prompt
mail connect imap.example.test user@example.test INBOX -unknown
Offline training example — no live HTTP, mail or TLS request
Unknown option: -unknown
Send diagnostic mail through the local PHP transport
mail send someone@example.test
Offline training example — no live HTTP, mail or TLS request
To, subject and text are required
Mail · box
mail box
Offline training example — no live HTTP, mail or TLS request
Mailbox name required

Related documentation

Current public release

v1.1.52026-08-12

Language synchronization

Finalizes Local and Server Help synchronization and localization safety for mail.