Ubuntu
:
I am trying to send an email with sendmail
, mailx
, or mail
(anything that will work). I am trying to send the contents of a log file as the message. Log located at /var/log/nginx/error.log
.
I am running a cron every hour to see if anything in the error log changed and if it has I am trying to send the error log to myself in an email. A regular test with sendmail and mailx and mail work just fine for me.
This works (but not what I want):
echo "My test email being sent from sendmail" | /usr/sbin/sendmail [email protected]
I tried the following (none of them work for me):
sendmail [email protected] < /var/log/nginx/error.log
,
/var/log/nginx/error.log | /usr/sbin/sendmail [email protected]
,
cat /var/log/nginx/error.log | /usr/sbin/sendmail [email protected]
,
mailx [email protected] < /var/log/nginx/error.log
,
cat /var/log/nginx/error.log | mailx [email protected]
Obviously a newbie here.