Sending Multipes files as attachents in directory

When i run the below command in Unix it works

echo|mailx -s "Subject"   $( printf -- '-a %q ' /Directory/*.* )  mail_address < /directory/mail_body.txt

But when the same command is run in AIX Platform I get invalid -a error .

Could you please help on this

What Unix? What shell?

What does man mailx say on either system?

we dont have the option for -a on on the platforms in the man for mailx.

Do we have any workaround to send multiples files in a directorty :

I have tried below but it doesnt attach files

(
   for i in /dir/*.*
   do 
      uuencode "$i" $(basename "$i") ;  
   done
) | mailx -s "Subject" mail_addrr < /dir/Mail_Body.txt
Flags

       Flags Description
       Item
            Description
       -c Address(es)
            Specifies the list of users to which a copy of the message is sent. You can specify one or more addresses. When specifying more than one address, the list of addresses must be in (" ") quotes.
       -d
            Specifies the debug information associated with the users mailbox
              *    uid
              *    user name
              *    mail file folder (the system mailbox)
              *    dead letter (the system saves incomplete messages in the dead.letter file in the $HOME
              *    mbox  (the personal mailbox)
            Note: The message is not sent when the program is in the debug mode.
       -e
            Tests for the presence of mail in the system mailbox. The mail utility will write nothing and exit with a successful return code if there is mail to read.
       -f FileName
            Reads messages from the named file. If a file operand is not specified, then reads messages from mbox. When you quit from reading the messages, undeleted messages are written back to this file.
The following options are accepted:

       -A name
              Executes an account command (see below) for name after the startup files have been read.

       -a file
              Attach the given file to the message.

       -B     Make standard input and standard output line-buffered.

       -b address
              Send blind carbon copies to list.  List should be a comma-separated list of names.

       -c address
              Send carbon copies to list of users.

       -D     Start in disconnected mode; see the description for the disconnected variable option.

       -d     Enables debugging messages and disables the actual delivery of messages.  Unlike -v, this option is intended for mailx development only.

       -e     Just check if mail is present in the system mailbox.  If yes, return an exit status of zero, else, a non-zero value.

       -E     If  an  outgoing message does not contain any text in its first or only message part, do not send it but discard it silently, effectively setting the skipemptybody variable at program startup.  This
              is useful for sending messages from scripts started by cron(8).

       -f [file]
              Read in the contents of the user's mbox (or the specified file) for processing; when mailx is quit, it writes undeleted messages back to this file.  The string file is handled as described  for  the
              folder command below.

 

Any Inputs

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.