Ask the Expert

Sending e-mail attachments from Unix systems to Windows recipients

We need a way to send e-mail with file(s) attachments from Unix systems running sendmail that will work in a Unix script so Windows based recipitants can save the attachments? We would call this script from a cron job to send an e-mail with the file(s) in a specific location attached.

We need to do this on both AIX 4.3 and Solaris 8. These systems have working e-mail but without a program like Pine or Mutt we are unable to send attachments in a format that a Windows / Outlook user can work with. Some of these attachments are over 5 Megs. Thank you for your time.


Requires Free Membership to View

First you may want to check your sendmail.cf to make sure there is no maximum limit in the max message size that may be 5mg or higher:

maximum message size
O MaxMessageSize=5000000

If it is 5mg, like it is above, increase the size to a large amount.

There are many ways that you code script e-mail from Unix. One way is to use the following syntax, which is the simplest method, sending data read from standard input:

$ mail -s "see attached file" root < /tmp/testfile.log.

Unfortunately on many occasions, especially with binary files, this does not work with many PC type e-mail readers. Mail delivery agents may transform the message by stripping the 8th bit of each character, or removing tab or blank spaces. Other more reliable methods of sending e-mail are with uuencode or MIME.

The uuencode solution is to encode the mail from binary format to a text format that is safe to transmit. The program is called "uuencode" ("UNIX to UNIX encoding"), the program to decode the data is called "uudecode".

The syntax you may use would be similar to this:

uuencode house.jpeg house.jpeg | mail jsilver@earthlink.net

The disadvantage for you here is that some mail programs to not have an automatic decoder that will enable the user to read these files.

The safest bet may be to use a Mime compatible software package, something like MetaMail. You can download this from the net at: ftp://thumper.bellcore.com/pub/nsb/

Good luck.


This was first published in January 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: