ksh : using mailx and attachments


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh : using mailx and attachments
# 1  
Old 08-01-2005
ksh : using mailx and attachments

Hi

I want to use mailx command to send a message included more than one file.
I tried to use uuencode in pipe but it could only generate one file.
I would avoid using an archive file Smilie

Thanks to read you.

Mathieu
# 2  
Old 08-01-2005
Try...
Code:
(  echo "message" 
   uuencode /path/to/file1 file1
   uuencode /path/to/file2 file2
   : etc
) | mailx -s "subject" abc@xyz.com

# 3  
Old 08-02-2005
Thanks a lot Igor

I toke your idea to write my solution Smilie
You could find it bellow :

SUBJECT=$1
BODY=$2
RECIPIENT=$3
FILE=$4 #Files to attach (like /tmp/myfiles_*.txt)

(cat $BODY
for i in `ls -1 $FILE`
do
file_name=`basename $i`
uuencode $i $file_name
done
) | mailx -s "$SUBJECT" $RECIPIENT

Regards
Mathieu
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with opening the UNIX mailx attachments on iPhone/iOS

I have created a simple log file (abc.log) with Hello World, from my UNIX script. At the end of the script, I have attached the log to my email using uuencode & mailx command. THe email was send successfully and opening on my desktop without any issues. I have the email sync with my iPhone... (7 Replies)
Discussion started by: karumudi7
7 Replies

2. Shell Programming and Scripting

Mailx sending attachments to personal email, but not SharePoint?

Hello! I am writing a KornShell script that (in addition to other things) sends a file from a Unix directory to a SharePoint directory. However when executing the script there is no sign of the file on the SharePoint. I have tested the script using my personal email as the destination and the... (3 Replies)
Discussion started by: mattkoz
3 Replies

3. Shell Programming and Scripting

Sending Multiple Attachments using MAILX

I have created a shell scripts and wanted to email users multiple attachments using mailx. I noticed that when I do a man on mailx I see and -a option for attachments. When I run a: mailx -s "test attachments" -a include_file -a exclude_file testuser@mydomain.com (Interrupt -- one more to... (1 Reply)
Discussion started by: metallica1973
1 Replies

4. Shell Programming and Scripting

KSH - mailx - Redirect the undelivered mail

Hi, I need to create one KSH which will send mail to set of recipients using "mailx" command like below. mailx -s "Test mail" "test@yahoo.com, test@gmail.com" <$output.txt The recipients are in different domains (like yahoo, gmail, etc.). My requirement is, if any mail is undelivered,... (1 Reply)
Discussion started by: Matrix2682
1 Replies

5. Shell Programming and Scripting

Not able to send multiple attachments using uuencode and mailx

Hi, I am seeing some junk characters when I attach the second file, given below is the logic I used. Please help me resolving the issue. ( uuencode file1.txt file1.txt.lst && uuencode file2.txt file2.txt.lst ) > attachment.txt cat body.txt attachment.txt > combinemail.txt mailx -m... (7 Replies)
Discussion started by: prasperl
7 Replies

6. UNIX for Dummies Questions & Answers

Using mailx to save attachments

Hi, I have a requirement to save a mail attachment sent from Windows to a Solaris 9 server. I'm using mailx on the server and have seen a few examples of how to attach a file for sending but none for how to save the attachment when receiving. I can see the encoded text when I look at... (2 Replies)
Discussion started by: Jublio
2 Replies

7. AIX

Aix Unix Mailx Attachments

I'm trying to send a mailx with an attachment, really I have not do it in a long time. I forgot (3 Replies)
Discussion started by: darioa
3 Replies

8. Shell Programming and Scripting

Mailx in shell script (KSH)

Greetings all, I'm pretty new to the use of mailx, having been using mutt most of the time. I'm interested to know how I can use mailx within a shell script to send out a formatted email with the following criterion: 1. My recipient's address is abcdef1000@gmail.com 2. The message body is... (2 Replies)
Discussion started by: rockysfr
2 Replies

9. UNIX for Advanced & Expert Users

mailx on ksh revisited

I have read through all documents in FAQ and have run into an issue with sending an email with body message text and an email attachment. I have included what I have thus far and I can get the message body to send in the email to work only. I cannot understand the uuencode even after I read the... (5 Replies)
Discussion started by: tekline
5 Replies

10. UNIX for Advanced & Expert Users

Problem with multiple excel attachments using mailx

I have written the following code send multiple attachments using mailx (uuencode file1 file1; uuencode file2 file2; uuencode file3 file3;) | mailx -s MultipleAttachments -r Sysadmin abc@xyz.com The attachments are coming properly if the file1,2,3 are either pdf, text, doc. But if these files... (2 Replies)
Discussion started by: ramanam2004
2 Replies
Login or Register to Ask a Question