Tools: email from any Linux server in 60 seconds — no SMTP config Send

Tools: email from any Linux server in 60 seconds — no SMTP config Send

Why the old path is so slow

What the 60-second path skips

Real-world recipes

Cron job that emails on failure

systemd OnFailure handler

Deploy notification from CI

Shell trap on script exit

What about mailx, msmtp, sendmail?

The 60-second checklist

A note for hardened environments

Next steps You ssh'd into a fresh Linux box and you need to send an email. Maybe a backup completed. Maybe a deploy succeeded. Maybe a process crashed and you want a stack trace in your inbox. The traditional path: install Postfix, edit main.cf, configure a smart relay, generate SASL credentials, restart the daemon, and pray nothing else on the box uses port 25. That is the 30-minute path. Three lines. Zero daemon. Works on every modern Linux distro and macOS. Setting up outbound SMTP from scratch involves five separate concerns: Five places to get it wrong. Most people get it wrong twice before it works. The CLI ships a static binary. No package dependencies, no system services, no firewall punches. The send happens over HTTPS to the Nylas API on port 443 — already open in 99% of environments. Specifically, you are not: This is exactly the pattern the systemd man pages document for OnFailure, with one less moving part. They are venerable, and on a single machine where you already have a working relay, they are fine. Where they hurt: The Nylas CLI replaces all three for the "I need to send from a script" use case. There is no relay to maintain because the relay is the API. If step 5 worked, you are done. Add the binary location to a system-wide PATH (e.g., symlink to /usr/local/bin) if other users on the box need it. If your server has no outbound HTTPS — air-gapped, restricted egress firewall — the CLI cannot reach the API. In that case, ship messages to an internal queue (or a relay box that does have egress) and let that machine call the CLI. The CLI itself is not the bottleneck; outbound HTTPS is. Otherwise, this is the cleanest "make this Linux box send mail" setup I have used. Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

$ -weight: 500;">curl -fsSL https://cli.nylas.com/-weight: 500;">install.sh | bash ~/.config/nylas/bin/nylas auth config --api-key YOUR_KEY ~/.config/nylas/bin/nylas email send --to [email protected] --subject hi --body "From $(hostname)" -weight: 500;">curl -fsSL https://cli.nylas.com/-weight: 500;">install.sh | bash ~/.config/nylas/bin/nylas auth config --api-key YOUR_KEY ~/.config/nylas/bin/nylas email send --to [email protected] --subject hi --body "From $(hostname)" -weight: 500;">curl -fsSL https://cli.nylas.com/-weight: 500;">install.sh | bash ~/.config/nylas/bin/nylas auth config --api-key YOUR_KEY ~/.config/nylas/bin/nylas email send --to [email protected] --subject hi --body "From $(hostname)" #!/usr/bin/env bash if /usr/local/bin/run-backup.sh; then exit 0 fi nylas email send --to [email protected] \ --subject "[FAIL] backup on $(hostname)" \ --body "$(date): backup failed. See /var/log/backup.log" #!/usr/bin/env bash if /usr/local/bin/run-backup.sh; then exit 0 fi nylas email send --to [email protected] \ --subject "[FAIL] backup on $(hostname)" \ --body "$(date): backup failed. See /var/log/backup.log" #!/usr/bin/env bash if /usr/local/bin/run-backup.sh; then exit 0 fi nylas email send --to [email protected] \ --subject "[FAIL] backup on $(hostname)" \ --body "$(date): backup failed. See /var/log/backup.log" # /etc/systemd/system/notify-failure@.-weight: 500;">service [Unit] Description=Notify on -weight: 500;">service failure for %i [Service] Type=oneshot ExecStart=/usr/local/bin/nylas email send --to [email protected] \ --subject "[%H] %i failed" \ --body "Check journalctl -u %i for details" # /etc/systemd/system/notify-failure@.-weight: 500;">service [Unit] Description=Notify on -weight: 500;">service failure for %i [Service] Type=oneshot ExecStart=/usr/local/bin/nylas email send --to [email protected] \ --subject "[%H] %i failed" \ --body "Check journalctl -u %i for details" # /etc/systemd/system/notify-failure@.-weight: 500;">service [Unit] Description=Notify on -weight: 500;">service failure for %i [Service] Type=oneshot ExecStart=/usr/local/bin/nylas email send --to [email protected] \ --subject "[%H] %i failed" \ --body "Check journalctl -u %i for details" # In any -weight: 500;">service that should notify on failure: [Unit] OnFailure=notify-failure@%n.-weight: 500;">service # In any -weight: 500;">service that should notify on failure: [Unit] OnFailure=notify-failure@%n.-weight: 500;">service # In any -weight: 500;">service that should notify on failure: [Unit] OnFailure=notify-failure@%n.-weight: 500;">service nylas email send --to [email protected] \ --subject "✅ Deploy v${VERSION} to prod" \ --body "https://app.example.com/deploys/${DEPLOY_ID}" nylas email send --to [email protected] \ --subject "✅ Deploy v${VERSION} to prod" \ --body "https://app.example.com/deploys/${DEPLOY_ID}" nylas email send --to [email protected] \ --subject "✅ Deploy v${VERSION} to prod" \ --body "https://app.example.com/deploys/${DEPLOY_ID}" trap 'nylas email send --to [email protected] --subject "rebuild done on $(hostname)" --body "exit code $?"' EXIT ./long-running-rebuild.sh trap 'nylas email send --to [email protected] --subject "rebuild done on $(hostname)" --body "exit code $?"' EXIT ./long-running-rebuild.sh trap 'nylas email send --to [email protected] --subject "rebuild done on $(hostname)" --body "exit code $?"' EXIT ./long-running-rebuild.sh # 1. Install -weight: 500;">curl -fsSL https://cli.nylas.com/-weight: 500;">install.sh | bash # 2. Add to PATH for the session export PATH="$HOME/.config/nylas/bin:$PATH" # 3. Auth nylas auth config --api-key YOUR_KEY # 4. Test nylas email send --to [email protected] --subject hi --body "from $(hostname)" # 5. Verify it landed (should be in your inbox in <30 sec) # 1. Install -weight: 500;">curl -fsSL https://cli.nylas.com/-weight: 500;">install.sh | bash # 2. Add to PATH for the session export PATH="$HOME/.config/nylas/bin:$PATH" # 3. Auth nylas auth config --api-key YOUR_KEY # 4. Test nylas email send --to [email protected] --subject hi --body "from $(hostname)" # 5. Verify it landed (should be in your inbox in <30 sec) # 1. Install -weight: 500;">curl -fsSL https://cli.nylas.com/-weight: 500;">install.sh | bash # 2. Add to PATH for the session export PATH="$HOME/.config/nylas/bin:$PATH" # 3. Auth nylas auth config --api-key YOUR_KEY # 4. Test nylas email send --to [email protected] --subject hi --body "from $(hostname)" # 5. Verify it landed (should be in your inbox in <30 sec) - Opening port 25 outbound (most cloud providers block this) - Setting up STARTTLS to a relay - Maintaining sender DKIM/SPF/DMARC keys (the API handles signing) - Writing config files in /etc/postfix - mailx needs an MTA underneath (Postfix, Exim). Nothing changes about the SMTP setup. - msmtp is itself an SMTP client, so you still maintain relay credentials and TLS. - sendmail is the historical command, usually backed by Postfix. - Send email from the terminal — full nylas email send reference - Best CLI email tools compared — head-to-head with mutt, mailx, msmtp - PowerShell email reports — same idea on Windows - Full command reference