Skip to content

Instantly share code, notes, and snippets.

@tacone
Created August 9, 2022 12:39
Show Gist options
  • Save tacone/5e35546429d20fdabc69d52a8d40370f to your computer and use it in GitHub Desktop.
Save tacone/5e35546429d20fdabc69d52a8d40370f to your computer and use it in GitHub Desktop.
Send a mail from the CLI using an external SMTP server
#!/bin/bash
echo -e '\n\nSample test body' | LC_ALL=C mail -Sv15-compat -Sttycharset=utf8 \
-S 'mta=smtp://smtpuser:smtppassword@smtphost:587' -S 'smtp-auth=plain' \
-a 'attachment.bin' \
-r '[email protected]' \
-s 'sample subject' \
-t '[email protected]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment