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
Mail is not connected
Connect through a hidden password prompt
mail connect imap.example.com user@example.com
Status    connected
Host      imap.example.com:993/ssl
User      user@example.com
Box       INBOX
Messages  128
Recent    2
Unread    4
Connect through a hidden password prompt
mail connect imap.example.com user@example.com INBOX -tls -p 143
Status    connected
Host      imap.example.com:993/ssl
User      user@example.com
Box       INBOX
Messages  128
Recent    2
Unread    4
List available mailboxes
mail boxes
INBOX
Archive
Sent
Trash
Select a mailbox
mail box Archive
Mailbox  Archive
Messages 128
List recent messages; optionally unread only
mail ls 20
42  2026-08-08  noreply@example.com  Deployment report
41  2026-08-07  admin@example.com    Backup complete
40  2026-08-07  alerts@example.com   TLS renewal
List recent messages; optionally unread only
mail ls 20 -u
42  2026-08-08  noreply@example.com  Deployment report
Read a message or save it to a file
mail read 42
From     noreply@example.com
To       user@example.com
Subject  Deployment report
Date     2026-08-08 09:15:00 UTC

Deployment completed successfully.
Read a message or save it to a file
mail read 42 -o sandbox/tmp/message-42.txt
sandbox/tmp/
  message-42.txt
Send diagnostic mail through the local PHP transport
mail send admin@example.com "lil diagnostic" "Mail transport test"
Mail accepted by local transport
Set optional message headers
mail send admin@example.com "lil diagnostic" "Mail transport test" -from lil@example.com -reply support@example.com
Mail accepted by local transport
Mark a message deleted | undo the mark
mail del 42
Message  42
Deleted  marked
Mark a message deleted | undo the mark
mail undel 42
Message  42
Deleted  cleared
Permanently remove messages marked deleted
mail expunge
Expunged  1
Disconnect and remove saved mail credentials
mail -e
Connection  closed
Reject an invalid recipient address
mail send not-an-email "test" "hello"
Invalid recipient address

Related documentation

Current public release

v1.1.52026-08-12

Language synchronization

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