How can I send attachment with ssmtp in Linux?

echo -e "to: [email protected]\nsubject: subject\n"| (cat - && uuencode /path/to/attachment attachment.name) | ssmtp [email protected]

This solution does not depend on mutt.


To send an attachment, you need to encode the message using MIME.

You could use Mutt

mutt -s SUBJECT -a ATTACHMENT_FILE_1 ATTACHMENT_FILE_2 -- EMAIL_ADDRESS < MESSAGE_FILE

or mpack

mpack -s SUBJECT -D MESSAGE_FILE ATTACHMENT_FILE EMAIL_ADDRESS

See also: