send an email with attachment from the command line

HRS

Dabbler
Joined
Aug 4, 2014
Messages
39
I would like to write a script that sends the configuration file (/data/freenas-v1.db) as an email attachment
I've seen a script for freenas that uses uuencode and mail, but uuencode is not available on truenas scale
a possible alternative is base64 but this sends the encoded file as a message not as an attachment
there are references to the "-a" flag of mail/mailx for attachment, but on truenas this serves to specify header fields

I could use python and smtplib, but this excessive for this small task

What is the recommended way to send an attachment by email in truenas scale?
Better yet, is there a working script to backup the configuration?
 

NugentS

MVP
Joined
Apr 16, 2020
Messages
2,947
Yes there is.
Look in resources - multi-report.sh will do what you want and more
 
  • Like
Reactions: HRS
Top