LinuxCommandLibrary

mailx

TLDR

Send email

$ mailx -s "[Subject]" [recipient@example.com]
copy
Send with body
$ echo "[message]" | mailx -s "[Subject]" [recipient@example.com]
copy
Send file
$ mailx -s "[Subject]" [recipient@example.com] < [message.txt]
copy
Send with attachment
$ mailx -s "[Subject]" -a [file.pdf] [recipient@example.com]
copy
Read mail
$ mailx
copy
Use SMTP server
$ mailx -S smtp=[smtp://mail.example.com] -s "[Subject]" [recipient@example.com]
copy

SYNOPSIS

mailx [options] [recipients]

DESCRIPTION

mailx is an enhanced mail command. It supports SMTP, attachments, and more features than basic mail.
The tool is POSIX-compatible with extensions. It handles both sending and reading email.
mailx sends and reads email.

PARAMETERS

RECIPIENTS

Email addresses.
-s SUBJECT
Email subject.
-a FILE
Attach file.
-c ADDR
CC recipients.
-S VAR=VALUE
Set variable.
-f FILE
Read from mailbox.
--help
Display help information.

CAVEATS

Multiple implementations exist. SMTP config varies. May need s-nail or heirloom-mailx.

HISTORY

mailx evolved from the original Unix mail command, adding features like MIME support and SMTP.

SEE ALSO

mail(1), mutt(1), sendmail(8)

> TERMINAL_GEAR

Curated for the Linux community

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99