How to add subject line when sending email output of find using ssmtp
12,074
Try this:
{
echo To: [email protected]
echo From: [email protected]
echo Subject: mov files greater than 1M
echo
find /path/to/folder/ -type f -size +1M -name "*.mov"
} | ssmtp [email protected]
You don't need the printf
on find
.
Related videos on Youtube
Author by
Bas
Updated on September 18, 2022Comments
-
Bas over 1 year
I got a script running (as cronjob) that will list the files in a folder before doing a Rsync job and emailing me the list. How can I add a subject line.
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%f\n" | ssmtp [email protected]
I tried this with -s "Subject" but no luck. It only works if I put the subject in a text file and call this text file
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%f\n" | [email protected] < /path/to/file/subjectline.txt
But than it won't add the search results in the Message.
Any thoughts on what I am doing wrong,
Bas
-
Bas over 8 yearsAwesome that works really well. The only reason I had the -printf "%f\n" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.