Need to attach a txt file while sending mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to attach a txt file while sending mail
# 8  
Old 01-10-2006
mutt is your friend...

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

Last edited by mr_manny; 01-11-2006 at 01:51 AM..
# 9  
Old 01-10-2006
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

Last edited by mahendramahendr; 01-10-2006 at 09:14 PM..
# 10  
Old 01-12-2006
MySQL

Great!!

It is working..

Thanks a lot Guys!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to attach a .txt file or .log file to mail and mailx command

Hi, I am trying to attach a .log file or .txt file to mail command to send an email once my ksh script executed. I am unable to use mutt command as it has been not installed and i am not supposed to install it. I have tried many ways by googling which has not helped me to succeed. Here is my... (5 Replies)
Discussion started by: Samah
5 Replies

2. UNIX for Dummies Questions & Answers

Sending mail in UNIX with body and attachment(.txt) using sendmail command

Hi All, In my .ksh script, I am sending an email with body and attachment (.txt) using sendmail command. I am able to receive the attachement along with the body of the mail. But I am getting special characters along with the content in the .txt. Also the alignment is incorrect. Can you please... (7 Replies)
Discussion started by: KRR
7 Replies

3. Shell Programming and Scripting

problem with sending mail from txt file having HTML code via sendmail -t

Hi, i have the following code in shell named as test3.sh.. #!/bin/sh . /home/<user>/.profile export dt=`date "+%d%b%y"` export tim=`date "+%d%b%y %HM:%MM"` cd export WD=`pwd` SID="<sid>" export SID export ORACLE_SID=$SID export ORACLE_HOME=/oracle/$SID/102_64 export... (4 Replies)
Discussion started by: jassi10781
4 Replies

4. Shell Programming and Scripting

How to attach multiple file to send mail command

Hi, i want color effect on mail as well as multiple attachment.I have code but this code is used for single attachment. I am unable to attach more than one file.:wall: I want to send two attachments -ahmed.csv and ahmed1.csv . Sample content: <html> <body> <b> Hi...</b> </body> </html> ... (1 Reply)
Discussion started by: AhmedLakadkutta
1 Replies

5. Shell Programming and Scripting

Script to attach file to mail

Hello, I have a .dat file containing one line. I need a script to read that line and make it part of the body and send a mail... Let's say the line is $line. I need the script to send a mail with the body "The last disposal feed is $line". Thanks (4 Replies)
Discussion started by: sfetea
4 Replies

6. Shell Programming and Scripting

Not able to attach text in body of email while sending mail with attachment

Hi, We have been trying to send mail with attachment and it is going fine, but when we try to attach a text to the body of the email, we find that the mail is going fine with the body text but the attachment is not going through. We are using ksh. The command that is successfull without the... (6 Replies)
Discussion started by: jmathew99
6 Replies

7. HP-UX

How to attach an excel file in a multipart (mime) mail

Hello. I need to send mails from hp-ux with 2 attachments: a text file and an excel file. So I'm composing a mime file which I will pipe to sendmail utility. This works fine if the only attachment is the text file (i use cat command to attach text content). But I have problems with the format... (3 Replies)
Discussion started by: elcampio
3 Replies

8. Shell Programming and Scripting

How to attach a file in Linux mail command

How to attach a file in Linux mail command Hi Guys, Is there any way to attach a file in Linux mail command without using "uuencode"? i.e. Code: file=/a/b/c/d/file.txtmail -s "Giga aks" abc@123.com <<HDoc`uuencode $file $file 2>/dev/null`HDoc Here, I don;t want to use 'uuencode'... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

9. Shell Programming and Scripting

How to attach a file & send mail thru script

In shell script how can I attach a file and send a mail. suppose if I written like the following way usr/bin/mail 'subject" "mail_id" < file. a mail goes to the mail-id with the content of file.But I want the file to be atttached to the mail.How can I get it.is there any way for this. ... (9 Replies)
Discussion started by: Mar1006
9 Replies

10. UNIX for Dummies Questions & Answers

How to attach a file in mail?

Hi, I want to know how to send a mail in unix using mailx or mail or sendmail to send a mail with a file attached. I have read the answers from the other threads but I still don't understand. I want to do it in the command line as well as in script. Can anyone help? DO I need to use... (1 Reply)
Discussion started by: firebirdonfire
1 Replies
Login or Register to Ask a Question