Skip to content

Instantly share code, notes, and snippets.

@emrahgunduz
Last active April 5, 2019 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emrahgunduz/5d909170fd3f86afe66890ae291cb6d1 to your computer and use it in GitHub Desktop.
Save emrahgunduz/5d909170fd3f86afe66890ae291cb6d1 to your computer and use it in GitHub Desktop.
Mailx and configuration for Cron email sending

To test use: echo "Something..." | mailx -v -A forcron -s "Cronjob completed on $(hostname)" email@example.com

To install: apt install mailx

Edit this file: /etc/mail.rc or /etc/nail.rc

If you need, you can check which file by running strings /usr/bin/mailx | grep rc

set ask askcc append dot save crt
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via D$
account forcron {
set smtp-use-starttls
set ssl-verify=ignore
set smtp-auth=login
set smtp=smtp://example.com:587
set from="Email Address <email@example.com>"
set smtp-auth-user=USERNAME
set smtp-auth-password=PASSWORD
set nss-config-dir="/etc/pki/nssdb/"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment