Need to attach a txt file while sending mail

Hi,

I need to attach a txt file while sending mail thru Unix.

Please help me out in this..

-Charan.

sending attachment had been answered many times,

could you please make use of the search facility:

search the forum

Thanks..

I need to attach a txt file as well as embed some text in the mail body.

How to add the mail body(Some text) while attaching a file like this :

uuencode abc.txt abc.txt | mailx -s "Attaching test" user@domain.com

Charan.

uuencode abc.txt abc.txt | mailx -s "Attaching test" user@domain.com < your_file_containing_message 

Madhan,

I tried this already..

uuencode abc.txt abc.txt | mailx -s "Attaching test" user@domain.com < your_file_containing_message

This is sending out a mail with the body of the "your_file_containing_message"
file.Doesnt attach the txt file.

Charan.

I am very sure the above command would work as requested.

Could you please post the exact command what you had tried?

That would be helpful to find out the problem.

I have used this..

uuencode datetime.txt datetime.txt | mailx -s "Attaching test" charan.p@igate.com < mail.txt

I am receiving the mail with the body of the "mail.txt" file.
I dont receive the attachment.

Charan.

How about using mutt?

mutt -a attachment -s "this is the subject" user@emailaddress.com < messageBODYfile.txt
or
echo "this is the messageBODY" | mutt -a attachment -s "this is the subject" user@emailaddress.com < /dev/null
or
cat messageBODYfile.txt | mutt -a attachment -s "this is the subject" user@emailaddress.com < /dev/null

Usage:
-a <file> attach a file to the message
-b <address> specify a blind carbon-copy (BCC) address
-c <address> specify a carbon-copy (CC) address
-e <command> specify a command to be executed after initialization
-f <file> specify which mailbox to read
-F <file> specify an alternate muttrc file
-H <file> specify a draft file to read header from
-i <file> specify a file which Mutt should include in the reply
-m <type> specify a default mailbox type
-n causes Mutt not to read the system Muttrc
-p recall a postponed message
-R open mailbox in read-only mode
-s <subj> specify a subject (must be in quotes if it has spaces)
-v show version and compile-time definitions
-x simulate the mailx send mode
-y select a mailbox specified in your `mailboxes' list
-z exit immediately if there are no messages in the mailbox
-Z open the first folder with new message, exit immediately if none
-h this help message

cat your_file_containing_message.txt && uuencode abc.txt abc.txt | mailx -s "Attaching test" user@domain.com

or

( cat your_file_containing_message.txt; uuencode abc.txt abc.txt ) | mailx -s "Attaching test" user@domain.com

Great!!

It is working..

Thanks a lot Guys!!