sending files as attachments

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sending files as attachments
# 8  
Old 04-11-2001
Question Mailx attachments

Caveat: this is the "dummy" forum, right?
That's where I belong. How do I find mimencode? I did a 'which mimencode' from the command line, and I can't find it. I'm running on a solaris 2.6. Thanks
# 9  
Old 04-11-2001
mimencode (also known as mmencode) is part of the metamail package. You can get a solaris version here:
Download to /tmp and "gunzip" it. Then do a "pkgadd -d /tmp"

You should now have mimencode installed in /usr/local/bin

Then you can run something similar to the following script (pipe it to mailx)

# Script: sendfile
# Purpose: Send the specified file via email as a MIME
# attachment to the specified address.
# Author: Anthony E. Greene &lt;;
# License: GPL &lt;;
# Note: This script does not include any error checking, so
# it should only be called from within other scripts.
# The correct syntax for using this script is:
# sendfile filename user@domain | /path/to/sendmail -t

# First we set up some global variables.
# Some code should be added to verify the commandline arguments.
basefile=`/bin/basename $filename`

echo From: $sender
echo To: $recipient
echo Subject: File $basefile
echo MIME-Version: 1.0
echo "Content-Type: multipart/mixed; Boundary=\"sendfile-attachment-boundary\""
echo --sendfile-attachment-boundary
echo 'Content-Type: text/plain; charset=us-ascii'
echo This is a MIME encoded message. If your mail software
echo cannot properly handle the attached file, you may need
echo to get a MIME-aware mailer.
echo --sendfile-attachment-boundary
echo "Content-Type: application/octet-stream; name=\"$basefile\""
echo Content-Transfer-Encoding: base64
echo "Content-Disposition: attachment; filename=\"$basefile\""
/usr/bin/mimencode $filename
echo --sendfile-attachment-boundary--</code>
# 10  
Old 04-13-2001

Thanks! I'll give it a try, but I'm not an SA, and in the past they haven't given me root access to install packages.
I'll see what I can do. The responses have been very helpful. Thanks again
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending an email with a body and attachments using uuencode

Hi, Im having a bit of an issue with using the uuencode command and sending out an email. My aim is to send an email out which has a body and also have attachments. Currently I can either get one or the other and not both on the same email. uuencode... (4 Replies)
Discussion started by: 02JayJay02
4 Replies

2. UNIX for Dummies Questions & Answers

Sending attachments via unix

OS Linux....Just curious as to why this is not working... uuencode test.txt "test.xls"|mailx -r -s "validation report" emailrecipient1,emailrecipient2 Please help....Any other options do we need to use?? (3 Replies)
Discussion started by: saggiboy10
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 (Interrupt -- one more to... (1 Reply)
Discussion started by: metallica1973
1 Replies

4. HP-UX

Sending Unix files as attachments in an email

Hi, I am executing the following command in order to send a file as an attachment: mailx -s "Subject" < Testfile.txt Instead of attaching the file Testfile.txt, it is writing the contents of the file in the email message body. Please advise on how I can send the file as an... (7 Replies)
Discussion started by: sangharsh
7 Replies

5. UNIX for Dummies Questions & Answers

Sending email attachments

Hello, I've search the forum, but I cannot find an answer to my specific question. I'm trying to send some files to my professor. Upon his request, I used the following: tar -cvf vh.tar vh_part1.c vh_part2.c vh_part3.c vh_part4.c vh_sample_run15.txt uuencode vh.tar vh.tar > proj1 mail... (2 Replies)
Discussion started by: venush
2 Replies

6. Shell Programming and Scripting

Sending multiple attachments

Hi people, I am new to this forums. I have a quick question I hope one of you could help me with. I am writing a script to send attachments via email. However I am having trouble when trying to send multiple attachments. Here is the code I am using: send_mail() { uuencode $TMP $TMP1 > $TMP1... (1 Reply)
Discussion started by: deo2k8
1 Replies

7. Shell Programming and Scripting

Sending text files as attachments

Hi, I have used the following command to send a text file "archiver.log" as attachment. (cat mail.log; uuencode archiver.log archiver.log; ) | mailx -s "Failure" : But in the mail i am not getting new lines in the text file.New Lines are getting replaced with some weird... (2 Replies)
Discussion started by: radhika03
2 Replies

8. UNIX for Dummies Questions & Answers

sending attachments in mail

Hi , i have tried the following command to send an email with an attachment its working fine but i am getting mail with the embeded content inside the mail that too truncated. i wanted it as an attachment. /usr/lib/sendmail -F "MAC SIA" address "" -t <... (6 Replies)
Discussion started by: rajendragora
6 Replies

9. UNIX for Advanced & Expert Users

sending attachments via unix

Hi, I need to send a mail attachment from the UNIX commandline. I'm using Tru64 and the mail client thats supposed receive the attached file (an excel sheet) is Lotus Notes. Can anybody help me out? (6 Replies)
Discussion started by: Abhishek Ghose
6 Replies

10. How do I send email?

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies
Login or Register to Ask a Question