Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-10-2004, 03:08 AM   #1
LQ Newbie
Registered: May 2004
Posts: 14

Rep: Reputation: 0
How to send email with attachment using "mail"?

I need to send an email with a binary attachment from the command line in a non interactive manner. I managed to do so with "mutt" but not with "mail".

I read something about encoding the attachment before sending it with "mail" because it can't handle binary content or something like that.

I would like to use "mail" if possible due to technical reasons I won't go into right now.
My questions are:

- Can "mail" send an attachment?
- Can "mail" send a binary attachment?
- If it can send a binary attachment, does it encode it (changing the actual file data)?
- The recepients are *NOT* unix mail clients. Can the attachments be read by them?

The binary attachment is a zip file of several other files.
Please provide command line examples.
Old 05-10-2004, 07:41 AM   #2
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
I have nail rather than mail, so I'm not sure if it works the same....try:
mail -a /path/to/file recipient
Old 05-10-2004, 07:48 AM   #3
Registered: Jul 2003
Posts: 658

Rep: Reputation: 30
you have all the answers:

man nail, or man mail
Old 05-10-2004, 08:22 AM   #4
LQ Newbie
Registered: May 2004
Posts: 14

Original Poster
Rep: Reputation: 0
I've managed to send an attachment with mail using:

zip data.txt | uuencode | mail -s "Subject goes here"

but the attachment cannot be opened. It is always corrupt.

I know I can use other tools but the problem is we have a ghost from which the OS is installed. It has the minimum software installed in order to run Redhat 9.
Therefore, using new tools which aren't in the current installation will require a new ghost which I'm trying to avoid.
Old 05-10-2004, 11:53 AM   #5
Registered: Oct 2002
Location: Bangalore
Distribution: Gentoo Linux
Posts: 96

Rep: Reputation: 16

You might be better off trying something like mutt or metamail.
If you're bent on using "mail", then, you'll have to construct the mail, it's headers and everything else yourself.

Try these links:



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 07:41 AM
Unable to send email "Relaying denied" ejain Linux - Software 3 05-30-2005 09:31 AM
Unable to send email "Relaying denied" ejain Linux - Software 2 05-21-2005 08:02 AM
How to have vsftpd ask for anon user to "send email for password"? dmurray8888 Linux - Software 0 04-27-2004 03:08 PM
Attach a Attachment with the " mail command" robinhood1995 Linux - General 2 05-16-2002 11:06 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:01 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration