email subject and bcc for crontab via msmtp

233 Views Asked by At

I'm currently scheduling cron jobs on my Raspberry (Buster) to run python3 code every day, and send the result via email through msmtp.

07 12 * * * python3 /home/pi/Documents/code.py 2>&1 | msmtp -a default [email protected]

this works without issues. However, the email is sent to [email protected] as bcc (and empty TO field) as well as without subject.

I've tried overriding the subject as follows

07 12 * * * python3 /home/pi/Documents/code.py 2>&1 | msmtp -s "test" -a default [email protected]

but I can't make it work. What am I doing wrong, how can I set TO and subject fields properly?

Thanks in advance

0

There are 0 best solutions below