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
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
send a mail using unix command with attachment and subject line
According to this article you can do what you want as:
(cat text.out; uuencode data.out data.out) | mail -s "DATA" abc@company.com
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
How to Export the Variable Through Script File
Grep Without Showing Path/File:Line
Creating a Bootable Iso Image with Custom Bootloader
How to Specify More Spaces for the Delimiter Using Cut
Colour Highlighting Output Based on Regex in Shell
User-Data Scripts Is Not Running on My Custom Ami, But Working in Standard Amazon Linux
Shell: Find Files in a List Under a Directory
Why Do Shells Ignore Sigint and Sigquit in Backgrounded Processes
How to Have the Cp Command Create Any Necessary Folders for Copying a File to a Destination
Just Black Screen After Running Qemu
Running Shell Script in Parallel
How to Check If Sed Has Changed a File
Init Function Invocation of Drivers Compiled into Kernel
Centos 64 Bit Bad Elf Interpreter
Run Script with Rc.Local: Script Works, But Not at Boot
Term Environment Variable Not Set
How to Establish Ssl Connection Upon Wget on Ubuntu 14.04 Lts