I try this for almost 4 hours now, in different ways. I googled a lot, but nothing I try work as expected.
I have a simple .msmtprpc file, that allows me to send mails like this:
echo -e "Subject: foobar\r\n\r\nContent" | msmtp my_mail@gmail.com
However, I can't seem to concatenate the full output of a Python script as content of the message.
This command:
( echo -e "Subject: aaa\r\n\r\n" ; python foo.py 2>&1; ) | msmtp foobar@gmail.com
works in my terminal, but not as a cron command. Perhaps we can improve it ?
Thanks for your time.