Computing.Net > Forums > Unix > How to attach a file to mail...

How to attach a file to mail...

Reply to Message Icon

Original Message
Name: Venkatesh
Date: January 20, 2000 at 08:23:10 Pacific
Subject: How to attach a file to mail...
Comment:

Hi,
I would like to attach a report file to the mail that I send using unix mail command (/usr/ucb/mail). Is that possible with unix mail. I am working on Solaris 5.7.

Thanx in advance...
Venkatesh


Report Offensive Message For Removal


Response Number 1
Name: Nathan Kahn
Date: January 27, 2000 at 02:50:46 Pacific
Reply: (edit)

I don't know about "attaching" a file, but you can certainly "mail" a file. Now if I could only remember how I used to do it :-(

If it's a text file, 'cat file | mail -s subject joe@abc.com' should work. Or just 'cat file | mail joe@abc.com' if you're not concerned with a subject line. If it's a binary, I know it can still be done -- keep digging :-)


Report Offensive Follow Up For Removal

Response Number 2
Name: Andrew Gerdel
Date: February 4, 2000 at 13:27:02 Pacific
Reply: (edit)

better idea. Have you ever used Pine or Elm? I think for attaching text files you'll have to use Elm. Easy prompts to follow. Type "Elm" at the prompt.


Report Offensive Follow Up For Removal

Response Number 3
Name: 10.20 for you
Date: February 10, 2000 at 20:26:59 Pacific
Reply: (edit)

Heres the deal...if the report is the body text of the email. I am not sure about attachments...

Use xmailer or elm (look at the man pages for options and syntax). At the end of the the command, redirect a text file into the command, using either a local user, or an smtp mail address, (command below may not be in exact order - look at man pages):
" `elm -s 'Subject Text' user@rochester.msn.com` < /tmp/myfile.txt "

This works on HP/UX 10.20. Hope this helps...


Report Offensive Follow Up For Removal

Response Number 4
Name: mike
Date: December 26, 2000 at 13:57:58 Pacific
Reply: (edit)

You can also use the uuencode command (with mail in AIX). Ex. uuencode unixfile.xyz remotefile.xzy | mail -s "send attach" recipient.name@company.com


Report Offensive Follow Up For Removal

Response Number 5
Name: James
Date: March 7, 2001 at 15:11:17 Pacific
Reply: (edit)

But, if it is a Unix file and needs to be seen
on a windows box, you must add a ^M to the end
of each line:
sed 's/$/^M/' bsr.txt >bsr1.txt

Tnx for the uuencode tip! Saved me a ton of time.


Report Offensive Follow Up For Removal


Response Number 6
Name: Laura
Date: April 16, 2001 at 10:22:12 Pacific
Reply: (edit)

The uuencode tip was very helpful ... next: can I
attach multiple files? ... both attach a file
and put text into the message body? ... if so,
how?


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: How to attach a file to mail...

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge