Solved

How to attach a file to email?

Posted on 2001-09-12
6
340 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

615 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