None of the mutt ones worked for me. It was thinking the email address was part of the attachemnt. Had to do:
echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com
ID : 10448
viewed : 43
Tags : linuxemailcommand-linelinux
99
None of the mutt ones worked for me. It was thinking the email address was part of the attachemnt. Had to do:
echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com
82
Or, failing mutt:
gzip -c mysqldbbackup.sql | uuencode mysqldbbackup.sql.gz | mail -s "MySQL DB" backup@email.com
72
Depending on your version of linux it may be called mail. To quote @David above:
mail -s "Backup" -a mysqldbbackup.sql backup@email.com < message.txt
or also:
cat message.txt | mail -s "Backup" -a mysqldbbackup.sql backup@email.com
63
From looking at man mailx
, the mailx program does not have an option for attaching a file. You could use another program such as mutt.
echo "This is the message body" | mutt -a file.to.attach -s "subject of message" recipient@domain.com
Command line options for mutt can be shown with mutt -h
.
56
I use SendEmail, which was created for this scenario. It's packaged for Ubuntu so I assume it's available
sendemail -f sender@some.where -t receiver@some.place -m "Here are your files!" -a file1.jpg file2.zip