Solved

How to attach a file to email?

Posted on 2001-09-12
6
337 Views
Last Modified: 2013-12-27
I am sending email programatically using sendmail, but it does not have an option for attaching files. Is there another mail utility that will? Haven't found anything in the man pages so far.
0
Comment
Question by:snazzyrags
6 Comments
 
LVL 1

Expert Comment

by:filiep
ID: 6478541
uuencode filename filename | /usr/ucb/mail -s 'subject' user@domain.be

Both filenames may be the same! This is not an error. This is working.

Regards,
F.
0
 
LVL 1

Expert Comment

by:k.kidambi
ID: 6480273
you can try the following.

mailx -v user@domain.name.com < {ur attachment}

Post your comments.

Kidambi
0
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 100 total points
ID: 6480737
filiep's idea for uuencode will work for some mail clients
that still support uuencode, but many do not.

k.kidambi's idea for simply including the file will work
if it's a plain text file and the recipient doesn't want to
deal with it as an attachment, but will otherwise fail.

The only way to get this to work for all settings is to MIME-encode
the attachment.

And the easiest way to do that is with Metamail, which is available from ftp://thumper.bellcore.com/pub/nsb/ 
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 2

Expert Comment

by:jonke
ID: 6484868
Any mail client that you can append files to will accept uuencoded files, as uunencoded files are all ascii based. both mail and mailx will work with a uuencoded file.
0
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6487499
Yes, but only to the extent that you can always save the mail to a file and decode it with uudecode, if you have a copy of it (which you would under Solaris, but not necessarily on the client systems).

Lots of mail clients do not know about any attachments at all, even MIME, but MIME is much more universally supported than uuencode, especially on PC platforms.
0
 

Expert Comment

by:iavhom
ID: 11956843
The best of all solutions I see is http://email.cleancode.org/ program.
Example of usage:
email -s 'email test' -f 'sender@domain.com' -a file1,file2 user1@domain1.com,user2@domain2.com < plain_text_mail_body.txt
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AIX    Volume group Auto ON/OFF question 2 118
how to check for shares on HP-UX 1 64
Virtualizing TAPE on dual VIOS 3 102
Field name with special character (Ñ) in Oracle 11 94
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

830 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