The quickest reliable method is to install Ubuntu’s supported mail transfer agent (Postfix) with Mailutils, then pipe a message into mail:
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
sudo apt update
sudo apt install postfix mailutils
printf '%sn' 'Body text from the server' | mail -s 'Ubuntu mail test' [email protected]
That command submits the message to the local Postfix queue. It does not, by itself, prove that the recipient’s provider accepted the message or placed it in the inbox. For a server that should relay through a managed SMTP service, configure authenticated SMTP with TLS or use a direct SMTP client such as SendEmail or Mailutils.
As an Amazon Associate I earn from qualifying purchases.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →What happens when a command sends mail
A terminal command is normally a mail user agent (MUA) or a thin client. It hands the message to a mail transfer agent (MTA), which queues it, resolves the destination, opens an SMTP connection, retries temporary failures and records diagnostics. A mail delivery agent (MDA) can then place locally addressed mail in a mailbox that users read through POP3 or IMAP.
Ubuntu documents this chain and states: “On Ubuntu, Postfix is the default supported MTA.” Postfix is therefore the natural local hand-off point for cron jobs, monitoring scripts and system notifications. The command’s exit status generally tells you whether the local process or SMTP server accepted the submission; final delivery depends on DNS, authentication, relay policy, sender reputation and the recipient’s filtering.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Choose the sending path
| Method | Best fit | Queue and retry behavior | Credential and TLS considerations | Diagnostics |
|---|---|---|---|---|
Postfix plus mail/Mailutils |
Cron and system scripts on a host that already has a controlled MTA | Postfix keeps a queue and retries deferred deliveries | Credentials and TLS are centralized in Postfix configuration; protect the files | Postfix queue, journal and mail logs |
| SendEmail | A small one-off or scripted submission to a specified SMTP endpoint | The SMTP server, rather than the client, normally provides durable queueing | Pass an authenticated SMTP account and use the relay’s TLS settings; avoid exposing secrets in history or process listings | Use -v and inspect the relay response |
| Mailutils SMTP client | SMTP URL parameters or interactive protocol diagnostics | Depends on the SMTP server when connecting directly | Supports SMTP URLs, authentication mechanisms and STARTTLS; do not leave passwords in shell history | Interactive ehlo, starttls and auth steps show capabilities |
For a send-only Ubuntu server, local Postfix configured to relay through an authenticated provider is usually easier to operate than exposing an Internet-facing SMTP service. A direct client is convenient when you do not want a local queue, but you then need to handle transient failures in your script or accept that the remote relay is the only durable queue.
Method 1: send through local Postfix and mail
Install the packages
- Refresh the package index and install Postfix and Mailutils:
sudo apt update sudo apt install postfix mailutils - When the package configuration screen appears, choose the mail-system type that matches the server’s role. For a machine that only sends notifications, a relay or local-only design is safer than accepting mail from the public Internet. Use a fully Internet-facing configuration only when you intentionally operate an SMTP server and have completed its DNS, abuse-prevention and security setup.
- After changing Postfix settings, restart the service:
sudo systemctl restart postfix.service
Submit a plain-text test message
Pipe the body on standard input and set the subject with -s:
Recommended Free Tools
printf '%sn' 'Body text from the server' | mail -s 'Ubuntu mail test' [email protected]
You can supply multiple recipients as separate arguments. For a script, generate the body with a here-document or another command, but keep the same standard-input pattern so that shell quoting does not alter the message unexpectedly.
Check whether Postfix accepted it
Immediately inspect the service and queue:
systemctl status postfix
postqueue -p
An empty queue can mean that Postfix delivered the message onward quickly; it is not proof that the recipient saw it. A queued item with a deferred status indicates that Postfix has not completed delivery and will normally retry. Record the queue ID when you need to correlate a command with log entries.
Use the sendmail-compatible interface in scripts
Postfix also provides a sendmail-compatible command that reads a complete message from standard input. The -f option controls the envelope sender:
printf 'From: [email protected]: [email protected]: Ubuntu testnnBody textn' | sendmail -f [email protected] [email protected]
The sendmail manpage warns that -- should terminate options before untrusted, user-supplied addresses. Use that boundary when your script accepts recipients from outside input. Diagnostics can appear on standard error and in syslog or the Postfix logging service, so capture both when troubleshooting.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Method 2: connect directly with SendEmail
SendEmail is a command-line SMTP client. It connects to the host and port you specify instead of handing the message to a local Postfix queue. On Ubuntu Noble, the SendEmail manpage identifies version 1.56-5.2.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
Install and send a basic authenticated message
sudo apt update
sudo apt install sendemail
sendEmail -f [email protected] -t [email protected]
-u 'Ubuntu test' -m 'Body text' -s smtp.example.com:587
-xu 'smtp-user' -xp 'smtp-password'
The documented options include -a for attachments, -cc and -bcc for additional recipients, -o for extended settings and -v for verbose protocol output. Port 587 commonly expects authenticated submission with STARTTLS, but the hostname, port, authentication method and sender-domain rules belong to your chosen relay. Add the TLS setting required by that relay through the installed client’s documented -o options; do not assume that using port 587 alone encrypts the session.
Keep the password out of history and process listings
The example uses -xp only to show the option. A real password on a command line can be recorded in shell history and may be visible to other users through process inspection while the command runs. Prefer a protected secret store or a file readable only by the account that sends mail. If a password was exposed during testing, rotate it and remove the old history entry where appropriate.
Method 3: use the Mailutils SMTP client
GNU Mailutils documents SMTP mailbox URLs such as smtp://user:pass@host:port, with optional authentication mechanisms. A URL is convenient for automation, but embedding a password in a URL has the same disclosure risks as putting it in a command argument.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteInteractive SMTP diagnostics
The Mailutils interactive client lets you observe each protocol stage:
mailutils smtp
At the prompt, the documented commands include:
connect smtp.example.com:587to open a connection.-tlsor the client’s TLS command to request encrypted transport where supported.ehlo mail.example.comto display the server’s advertised extensions.starttlsto upgrade a submission connection when the server offers it.authto authenticate with a supported mechanism.from [email protected]andto [email protected]to set the envelope addresses.sendto submit the message.
Mailutils’ current manual edition is 3.21, updated 12 October 2025. Exact prompts and authentication mechanisms can vary with the installed build and the relay’s advertised capabilities, so use the client’s built-in help if a command is rejected.
Configure Postfix to relay through authenticated SMTP
Relaying through a managed SMTP service lets local scripts use the familiar mail command while the provider handles Internet delivery. The provider’s current documentation is authoritative for its endpoint, port, authentication method, sender requirements and certificate policy.
Set the relay endpoint
Set relayhost to the provider’s SMTP endpoint. A bracketed host prevents Postfix from looking up MX records for that name:
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
sudo postconf -e 'relayhost = [smtp.example.com]:587'
For a different provider, substitute its documented host and port. Do not copy a port or hostname from an unrelated service; these values change and some providers require a region-specific endpoint.
Enable SASL authentication and TLS
SMTP-AUTH identifies the client through SASL, while TLS encrypts the session and protects credentials in transit. A typical Postfix relay configuration enables authentication and requires encrypted delivery:
sudo postconf -e 'smtp_sasl_auth_enable = yes'
sudo postconf -e 'smtp_tls_security_level = encrypt'
sudo postconf -e 'smtp_tls_CApath = /etc/ssl/certs'
Authentication-map and certificate-verification settings must match the provider’s instructions and the authentication mechanism it advertises. A provider may require a submission port, an application-specific credential, a particular envelope sender or a verified domain.
Store credentials with restrictive permissions
One common Postfix arrangement is a password map readable only by Postfix:
sudoedit /etc/postfix/sasl_passwd
Enter the provider’s documented map entry in the form smtp.example.com:587 smtp-user smtp-password, save the file, build the database and restrict both files:
sudo postmap /etc/postfix/sasl_passwd
sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo systemctl restart postfix.service
The account that runs Postfix must be able to read the resulting map, but unrelated users should not. If your provider documents a different credential backend, use that instead. Never commit the password map to source control or place it in a world-readable backup.
Send through the relay
Once the relay is configured, the same local command works:
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
printf '%sn' 'Relay test from Ubuntu' | mail -s 'Authenticated SMTP test' [email protected]
Watch the log while submitting so you can distinguish local acceptance, authentication, TLS negotiation and remote rejection:
Free tools Windows power users keep installed
One-click scans. No signup required.
sudo journalctl -u postfix -f
Test SMTP and TLS without sending a full message
Ubuntu’s Postfix guide demonstrates checking SMTP capabilities with Telnet:
telnet mail.example.com 25
ehlo mail.example.com
Telnet is plaintext and should be used only where that is appropriate; never type real credentials into an unencrypted session. For a STARTTLS submission endpoint, use a TLS-aware diagnostic such as:
openssl s_client -starttls smtp -connect smtp.example.com:587 -crlf
After the connection is established, issue EHLO mail.example.com. A correctly configured server may advertise capabilities such as 250-STARTTLS and 250-AUTH. If STARTTLS is absent, stop and verify the port and provider documentation rather than sending credentials. Certificate errors, an unexpected hostname or a failed TLS upgrade indicate a configuration or endpoint problem that should be fixed before testing authentication.
Troubleshoot a message that did not arrive
1. Confirm the local service and queue
- Check the service:
systemctl status postfix. - List queued mail:
postqueue -p. - Look for a deferred item, a bounce, or a queue ID that you can trace.
If Postfix is stopped, start it and then inspect why it failed before resubmitting repeatedly. Repeated retries can create duplicate messages once the original eventually leaves the queue.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 112. Read the logs
Use the systemd journal for the service:
sudo journalctl -u postfix --since '15 minutes ago'
On systems where it is enabled, the traditional system mail log contains the same delivery conversation:
sudo tail -n 100 /var/log/mail.log
Search for the queue ID, recipient address, SMTP status code, authentication failure, TLS error or remote rejection text. A local “queued” line means Postfix accepted the message; a later “status=sent” line means the next SMTP hop accepted it, not necessarily that the final mailbox displayed it.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
3. Check network and name resolution
- Verify that the server resolves the relay hostname and the recipient domain.
- Check outbound firewall rules and whether the hosting network blocks TCP port 25 or requires submission on 587 or 465.
- Confirm the server’s hostname and reverse DNS. Poor or missing reverse DNS can cause remote deferral or rejection.
- Check the sender domain’s SPF, DKIM and DMARC policy. A relay may require domain alignment or refuse an unverified sender.
4. Check authentication and provider policy
- Confirm the username, credential type and endpoint are correct for the selected region or account.
- Ensure the password map is readable by Postfix but not by other users.
- Read the provider’s exact SMTP rejection text; it may identify a blocked sender, unverified domain, rate limit or prohibited recipient.
- Repeat the EHLO and STARTTLS capability test on the same host and port that Postfix uses.
5. Rotate anything exposed during testing
If a password appeared in shell history, a process listing, a transcript or a world-readable file, treat it as compromised. Revoke or rotate it at the provider, replace the protected map, restart Postfix and remove unnecessary copies. Do not solve an authentication problem by disabling TLS or certificate verification.
Reliable patterns for cron and system scripts
Use a controlled envelope sender
Set a sender address from a domain you control and that your relay permits. The visible From: header and the SMTP envelope sender are related but not identical; a relay can reject one even when the other looks valid. The sendmail-compatible -f option controls the envelope sender, while a complete message can include its own headers.
Capture errors and preserve queue IDs
Scripts should log the command’s exit status and, for Postfix submissions, retain the queue ID from the journal when possible. A zero exit code means the submission step succeeded. It does not guarantee remote acceptance, inbox placement or human reading. For important alerts, monitor the queue and provider bounces instead of relying on the initial command result.
Attach files only when needed
SendEmail documents -a for attachments. Keep attachment size within the relay’s documented limit, use a content type appropriate to the file and avoid sending secrets in clear-text attachments. For routine monitoring, a short text body is more portable and less likely to trigger size or filtering limits.
Security and deliverability checklist
- Use authenticated SMTP submission and TLS for external relays.
- Keep credential files readable only by the account or service that needs them.
- Do not put real passwords in shell history, shared scripts, process arguments, repositories or backups.
- Verify certificates and hostnames; do not disable verification to bypass an error.
- Use a sender domain with correct SPF, DKIM and DMARC alignment where the relay supports it.
- Maintain accurate hostname and reverse-DNS records for servers that connect directly to recipient MX hosts.
- Limit outbound mail to the recipients and rate your application actually requires.
- Inspect Postfix logs and the queue after configuration changes.
- Rotate credentials immediately after accidental disclosure.
Which method should you use?
Choose local Postfix plus mail when several scripts, cron jobs or system services need a dependable local queue and one central relay policy. Choose SendEmail when a small script must connect directly to a known SMTP endpoint and can handle its own failures. Choose Mailutils’ SMTP client when SMTP URLs or interactive capability testing are more useful than a local queue.
In every case, separate three outcomes: the shell client ran, the local MTA or remote SMTP server accepted the message, and the recipient’s mailbox delivered it. Only the last outcome answers whether the reader actually received the mail, and it must be verified through queue records, SMTP responses, bounces and recipient-side evidence rather than a successful command alone.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




