Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

Install and Use GNU Mailutils on Ubuntu

Published

Linux Email Tools

GNU Mailutils provides a command-line mail client. On an Ubuntu VPS, it can compose messages for server reports and read local mailboxes. Installing the client is not the same as configuring reliable Internet email delivery.

This guide covers the client commands documented for Ubuntu 24.04. It assumes you have administrator access and an approved outbound mail transport. It does not configure a public mail server or promise inbox delivery.

1. Check the existing mail setup

Before installing packages on a production server, find out whether Postfix, Exim, or a hosting control panel already manages email. Replacing its transport can interrupt website notifications and existing mailboxes. If this is a managed server, ask support before changing the mail stack.

command -v sendmail
command -v mail
apt-cache policy mailutils

A path for sendmail only confirms that an executable exists. It does not prove that its relay settings, credentials, DNS, or delivery policy are correct.

2. Install the client

sudo apt update
sudo apt install mailutils
mail.mailutils --version

Read the package changes before accepting. If the installer offers to install or replace a mail transport, stop unless that is part of your deployment plan. Do not choose an Internet-facing mail-server configuration merely to get past an installation screen.

The examples use mail.mailutils explicitly because another package may also provide a command named mail with different options.

3. Send a controlled test

Replace the example address with a mailbox you control. Send only a harmless test message:

printf '%s\n' 'Test from the server mail client.' | mail.mailutils -s 'Mail transport test' admin@example.com

Successful submission is not proof of final delivery. Check the receiving mailbox and the configured transport’s logs. For external delivery, use either an authenticated relay or a correctly administered mail server. Your transport determines how authentication and TLS are configured; Mailutils installation alone does not supply those settings.

4. Attach a report

GNU Mailutils uses uppercase -A for an attachment. Replace the path with an existing readable file:

printf '%s\n' 'Attached is the requested report.' | mail.mailutils -s 'Server report' -A /path/to/report.txt admin@example.com

Review the report before sending it. Configuration files, database exports, and logs may contain secrets. Do not email those files simply to test attachments.

5. Read local mail

mail.mailutils

This opens the current user’s local mailbox when one is available. It does not automatically connect to a hosted Gmail, Microsoft 365, or InterServer mailbox. Enter ? for the client’s available commands.

Troubleshooting without losing mail

  • Command not found: confirm the package installed successfully and use the full command name shown above.
  • Submission fails: inspect the error and the existing transport configuration before installing a different mail server.
  • Message is queued: use the queue inspection tools for your actual transport. A temporary remote refusal is not a reason to delete the queue.
  • Message is rejected or marked as spam: examine the delivery status and sending-domain authentication. Adding an SPF record without understanding the actual sender can make matters worse.

Do not run blanket queue-deletion commands as a routine fix. They can permanently discard unrelated customer messages. For help, include the delivery error, timestamp, and transport name in a support ticket, with credentials and private message content removed.

Reference: Ubuntu 24.04 GNU Mailutils command reference. Commands were checked against this reference; this article does not claim an end-to-end delivery test on your server.

Account services are unavailable until the production backend is configured.