# howto mail an attached file in console



## ivand58 (Mar 17, 2009)

hi
how can i send an email with attached binary file from the console


----------



## anomie (Mar 17, 2009)

Here's what I do: 

```
%echo 'This goes in the body.' | \
uuencode /home/mrbig/binary-file attach-name | \
mail -s 'Subject here' mrbig@yourplace.local
```


----------



## fonz (Mar 17, 2009)

ivand58 said:
			
		

> hi
> how can i send an email with attached binary file from the console


Depends on whether you want MIME or uuencode or something else.

Here's what I do to send a file _grolsch.btl_ to a user _me@thirsty.nl_:
`% elm -A grolsch.btl -s "Have a beer!" [email]me@thirsty.nl[/email]`

Hope this helps,

Alphons

P.S. If you don't need text in the message's body, prepend with *echo ""|*


----------



## DutchDaemon (Mar 17, 2009)

Or:


```
mail/biabam               A command-line attachment mailer

Biabam Is A Bash Attachment Mailer

To use BIABAM use the following syntax:

echo [body] | biabam attachment1,[attachment2,attachmentN] [-s subject] \
              recipient1[,recipient2,recipientN]

Example:
echo "Here are the tarballs you requested" | biabam \
     foobar-0.7.8.tar.gz,coolapp-0.4.3.tar.gz,otherapp-4.3.0.tar.gz \
     -s "Answer to your request" john@doe.org,john2@doe.org

If no text is piped into biabam, it will wait for text on standard input
(finish with CTRL-D)
```


----------

