Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-15-2008, 12:58 PM   #1
Registered: Mar 2008
Posts: 108

Rep: Reputation: 16
Question "mail" command screws up my stuff

I use the mail command to send a .xls to an email address, but when it's received, although the subject heading is okay, the contents have become corrupted or something, (as in" ࡱ ", and other similar junk near the bottom) and the attachment isn't there.

I used this command:

mail -s "My email" < $HOME/spreadsheet.xls
what could have gone wrong! Was I supposed to specify encoding or binary or what?!

Last edited by hashbangbinbash; 04-15-2008 at 01:01 PM.
Old 04-15-2008, 01:07 PM   #2
LQ Newbie
Registered: Jul 2006
Posts: 29

Rep: Reputation: 16
uuencode attachments

Although some say this method is outdated, I still use it.

uuencode filename.ext filename.ext | mail

This will uuencode the file first then send it to the user. ALthough no text is sent with the email. Most times their email program should uudecode the attachment.

Hope it helps.

Old 04-15-2008, 01:15 PM   #3
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060Reputation: 1060
Ah, sending non-ASCII stuff...

Here's one way:
cat ${1} | uuencode "${1}" | mailx -s ${1} ${2}
I save this as douu, make it executable (chmod 755 douu) and run it with
douu whoever@wherever.what
or something similar and will be sent as an attachment.

If you constantly only send to one addressee, just change ${2} to the e-mail address; if you send copies to a bunch of folk, insert
-c who@where,who@where
before ${2} or a hard-coded addressee.

Hope this helps.

Last edited by tronayne; 04-15-2008 at 01:29 PM.
Old 04-15-2008, 06:42 PM   #4
LQ Newbie
Registered: Nov 2007
Posts: 21

Rep: Reputation: 2
use the mpack command for that

The 'mail' command is for plain ascii messages. You want to send a "binary" attachment. That is what mpack is for.

$ mpack -s 'here is your XLS file' filename.xls
Old 04-16-2008, 07:19 AM   #5
Registered: Mar 2008
Posts: 108

Original Poster
Rep: Reputation: 16
I'm using CentOS for this one, and I seem to have to install uuencode and mpack to try them out, which isn't going well.

Still, thanks for all the fish!
Old 04-16-2008, 08:22 PM   #6
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
You could see whether mutt is installed, and use that instead ... it handles
attachments gracefully with a -a flag ...



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
Postfix - "mail command not found" azmadar Linux - Networking 3 01-21-2013 04:52 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 11:18 PM
Sending mail with some attached files using "mail" command? zahadumy Linux - Software 3 05-27-2006 11:43 PM
"mail" shell command under FedCore4 wossy Linux - Newbie 3 04-08-2006 06:27 AM
Attach a Attachment with the " mail command" robinhood1995 Linux - General 2 05-16-2002 12:06 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:58 PM.

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