How do I send a file as an email attachment using Linux command line?
None of the mutt ones worked for me. It was thinking the email address was part of the attachment. Had to do:
echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.example
How to attach a file using mail command on Linux?
Example using uuencode:
uuencode surfing.jpeg surfing.jpeg | mail sylvia@home.com
and reference article:
http://www.shelldorado.com/articles/mailattachments.html
Note:
you may apt install sharutils
to have uuencode
command
sending email in linux as subject and attachment
There are at least a couple of programs that you can use to send a message with attachments:
The
mailx
program on my Linux system has a-a
option for attaching files as MIME parts:echo Test body | mail -s "Test subject" -a test.txt test@example.com
Mutt
will also do this:echo Test body | mutt -s "Test subject" -a test.txt -- test@example.com
Related Topics
Uninstall Node.Js Using Linux Command Line
How to Compare Two Strings in Dot Separated Version Format in Bash
Best Practices When Running Node.Js With Port 80 (Ubuntu/Linode)
Finding Which Process Was Killed by Linux Oom Killer
More Elegant "Ps Aux | Grep -V Grep"
How to Copy Commits from One Git Repo to Another
Controlling a Usb Power Supply (On/Off) With Linux
How to Handle More Than 10 Parameters in Shell
How to Run a Shell Script on a Unix Console or MAC Terminal
Curl Command to Repeat Url Request
How to Measure the Actual Memory Usage of an Application or Process
Confused About Stdin, Stdout and Stderr
Retaining File Permissions With Git
How to Access Physical Addresses from User Space in Linux
How to Build & Install Glfw 3 and Use It in a Linux Project
How to Show All Shared Libraries Used by Executables in Linux