Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Sending email from cron/bash without setting up a local MTA

Every time I spin up a new VM and want a cron job to email me — disk full, backup finished, cert expiring, I hit the same wall. To send mail from a script you either stand up a local MTA (postfix/exim/sendmail) and relay it somewhere, or w…

0
↗ Quelle (reddit.com)
Reagiere als Erste:r — dein Feedback zählt!

Every time I spin up a new VM and want a cron job to email me — disk full, backup finished, cert expiring, I hit the same wall. To send mail from a script you either stand up a local MTA (postfix/exim/sendmail) and relay it somewhere, or wire up msmtp/ssmtp against an SMTP account. And half the time the cloud provider blocks outbound port 25 (and increasingly 587), so even the lightweight path fights you.

I've been using the Nylas CLI to skip all of that. Disclosure up front: I work on it, so take it with a grain of salt but the problem predates the tool and this is genuinely how I do it now.

It's a single binary that sends over HTTPS (443), so there's no MTA to configure, no relay, and no dependence on port 25/587 being open.

First-time setup on your workstation (creates/logs into an account and connects an email address):

nylas init 

Then grab your API key to carry over to a server:

nylas auth token 

Headless boxes don't have a desktop keyring, so pass the key by env var instead. NYLAS_DISABLE_KEYRING=true forces the encrypted file store instead of the keyring, and NYLAS_API_KEY overrides stored creds:

NYLAS_DISABLE_KEYRING=true NYLAS_API_KEY=nyk_v0_xxx nylas email list 

Once that works, sending is one line you can drop in any script:

nylas email send \ --to [email protected] \ --subject "Backup done on $(hostname)" \ --body "Finished at $(date)" \ --yes 

Since --body is just a string, pipe command output straight in:

nylas email send --to [email protected] \ --subject "Disk on $(hostname)" \ --body "$(df -h)" --yes 

Crontab on a headless server — set the env once at the top so every job inherits it, then a nightly disk report at 7am:

NYLAS_DISABLE_KEYRING=true NYLAS_API_KEY=nyk_v0_xxx 0 7 * * * nylas email send --to [email protected] --subject "Disk $(hostname)" --body "$(df -h)" --yes 

For a systemd timer, put the key in an EnvironmentFile instead so it's not sitting in the crontab.

Honest tradeoffs, because this sub will (rightly) ask:

  • It's a hosted API, not FOSS, and it needs a free account + API key. If you already have an SMTP account and unblocked ports, msmtp is lighter and fully open — just use that.
  • The win is specifically when you don't want to run an MTA, the box has 25/587 blocked, or you'd rather not park SMTP creds on the host. HTTPS-only egress covers a lot of locked-down cloud VMs.
  • Mail lands from a real address (your Gmail/Outlook/domain), so it's less likely to get binned than mail from a fresh VM's postfix with no rDNS/SPF.

How's everyone else handling cron/script notifications these days — local MTA + relay, msmtp, curl to an email API, or something else? Genuinely curious what the current default is.

submitted by /u/mqasimca
[link] [comments]
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Sending email from cron/bash without setting up a local MTA

Thematisch verwandte Begriffe: Sending, email, from, cronbash · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-101042 | Parse Server is an open-source backend server. In versions >= 9.0.0 < 9…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag