I am trying to send the contents of a logfile via email like this:
sendmail -f deamon@mydomain.tld recepient@mail.com < /private/var/log/mylog
Unfortunately, this does not work – the email arrives in the inbox but is empty.
The same is true for this variation:
echo "$(</private/var/log/mylog)" | sendmail -f deamon@mydomain.tld recepient@mail.com
But when echoing some string like this:
echo "testing" | sendmail -f deamon@mydomain.tld recepient@mail.com
the email arrives with the content. Also, using cat
to view the file's content works too. This leads me to the conclusion that is has to be something with the way I wrote the command, but I don't see any syntax problem or similar.
What am I missing – why do the emails arrive empty when trying to send the file contents?