How to send multiple email attachments from AIX?

Posted on 2004-10-21
Last Modified: 2013-11-17
Does anybody know of a way to send multiple attachments within a single email (for AIX).

We currently use the following programs for sending emails:
* "sendmail": Will send an email, but with no attachments at all.
* "mpack": Will send an email with only one attachment.

The one that I am currently experimenting with:
* "metasend": Which will send multiple attachments, but changes the filename to always have a .txt extension.  I have managed to change the file description (before the extension) but the file always has a .txt at the end (eg FILENAME.CSV.txt).  I am setting the MIME type as text/plain to avoid any data formatting/conversion (any other ideas are much appreciated), which is why the .txt always appears at the end... very frustrating.

Does anybody know how to overcome the file naming issue with metasend, or does anybody know of any other (preferably easier to use) programs that can send multiple emails within an email, while maintaining the file format and filename & extension.

I have looked around on the net but have been unsuccessfull in locating anything that would be able to help.
Any ideas would be much appreciated.
Question by:JosipKulundzic
    LVL 60

    Expert Comment

    The problem is that you read mails in outlook that changes file names for some mime types, like text/plain
    LVL 14

    Accepted Solution

    I recommend "mutt" ( Just like "mail" except that you can use "mutt -s 'Subject of mail' -a first-attachment -a second-attachment <body.txt".
    LVL 2

    Expert Comment

    You can also try this method, using sendmail:
    Example: I want to send and file.two as attachments to

    uuencode >temporary.file
    uuencode file.two file.two >>temporary.file
    cat temporary.file | mail -s "two files attached"

    Note on uuencode - first parameter is input file name, second parameter is name you want the attachment to have when it is received by someone else. The names can be the same or different.
    uuencode will encode the attachment. In the first case, I am creating a new holding file. In the second case, I am appending to the holding file created by the first uuencode. The holding file is a single file containing all attachements. The holding file will appear as ASCII text, containing the encoded attachments.
    If the recipient is on a UNIX system, he/she will need uudecode.
    PC & Mac recipients should not need any helper application, as most personal computer mail applications can handle this type of attachment.

    LVL 38

    Expert Comment

    Have a look at the shell script in http:Q_21072849.html


    you can also zip/gzip/tar the files into one and send it
    LVL 1

    Author Comment

    Thanks ppl for all your effort.

    I have tried mail, mpack, sendmail and metasend, and all had issues of some sort.
    I found the mutt to be the cleanest and simplest to use for multiple attachments.
    Thank you all.


    Expert Comment


    In addition to reply of "jonkreisler"  foll. should work fine...

    cat file1 file2 |  mail -s "two files attached"


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    The Complete Ruby on Rails Developer Course

    Ruby on Rails is one of the most popular web development frameworks, and a useful tool used by both startups and more established companies to build strong graphic user interfaces, and responsive websites and apps.

    Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
    In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
    Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now