LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-15-2008, 11:58 AM   #1
hashbangbinbash
Member
 
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:

Code:
mail -s "My email" hashbang@binbash.net < $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 12:01 PM.
 
Old 04-15-2008, 12:07 PM   #2
jei
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 user@domain.com

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.

Jei
 
Old 04-15-2008, 12:15 PM   #3
tronayne
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:
Code:
cat ${1} | uuencode "${1}" | mailx -s ${1} ${2}
I save this as douu, make it executable (chmod 755 douu) and run it with
Code:
douu file.name whoever@wherever.what
or something similar and file.name 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
Code:
-c who@where,who@where
before ${2} or a hard-coded addressee.

Hope this helps.

Last edited by tronayne; 04-15-2008 at 12:29 PM.
 
Old 04-15-2008, 05:42 PM   #4
clsgis
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 recipient@example.com
 
Old 04-16-2008, 06:19 AM   #5
hashbangbinbash
Member
 
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, 07:22 PM   #6
Tinkster
Moderator
 
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 ...


Cheers,
Tink
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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