Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to attach a file using mail command on Linux? [duplicate]

I'm on a server running a Linux shell. I need to mail a simple file to a recipient. How to do this, prefereably using only the mail command?

UPDATE: got a good solution, using mutt instead:

$ echo | mutt -a syslogs.tar.gz [email protected] 
like image 739
Seiti Avatar asked May 23 '09 22:05

Seiti


People also ask

What is mail command in Linux?

In Linux, the mail command is a command-line utility that is used to send and manage the emails from the command line. The mail command is not used to send emails only but also to view and receive emails from the recipients.


1 Answers

Example using uuencode:

uuencode surfing.jpeg surfing.jpeg | mail [email protected] 

and reference article:

http://www.shelldorado.com/articles/mailattachments.html

Note:

you may apt install sharutils to have uuencode command

like image 179
Jon Avatar answered Sep 23 '22 08:09

Jon