1

I am in the process of trying to run a ksh script which usually sits on an AIX machine on its new host Linux node.

The code I am running looks like this:

 (uuencode $path/info.dat info.csv; uuencode $RESULTS results.log) | mail -s "Info" $MAIL_RECIPIENTS

This normally sends an email with the subject "Info" and contains the attachments info.csv and results.log.

However on my Linux machine this isn't happening - it is sending the email with the uuencode output as the body of the email and no attachments:

begin 775 info.csv

M+3`U+C`S+C4S+C(Q-#`W."(L(D%55$]314Y$("`B+")!551/4T5.1"`@(BPB
etc..
etc...
end

begin 775 results.log
M+3`U+C`S+C4S+C(Q-#`W."(L(D%55$]314Y$("`B+")!551/4T5.1"`@(BPB
etc...
etc...
end

I have tried to just send the files as attachments without using uuencode at all:

mail -a info.csv -a results.log -s "Info" $MAIL_RECIPIENTS

But this is being invoked in the middle of a script and it just hangs unless I CTRL D.

This is the version of uuencode I am using:

uuencode (GNU sharutils) 4.7
Copyright (C) 1994, 1995, 1996, 2002, 2005, 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Has anyone else experienced this? I am afraid mutt is not an option.

3 Answers3

1

Since the body of the email was empty anyway I was able to do this to stop the mail utility hanging waiting for EOT.

mail -a info.cvs -a results.log -s "Info" $MAIL_RECIPIENTS < /dev/null
0

You can use mailx for sending a mail with body and attachment and use it like this:

$ echo "body" | mailx -a AttachmentFile -s "subject" recipient@somewhere.com
Maryam Homayouni
  • 905
  • 9
  • 16
-1

Use this:

uuencode info.cvs info.cvs |mailx -s 'results.log' -r $ReplyAddress $MailAddress
Pokechu22
  • 4,984
  • 9
  • 37
  • 62
Ace
  • 1