Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to attach a file to email?

Posted on 2001-09-12
6
Medium Priority
?
342 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 400 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
Independent Software Vendors: 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!

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
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…
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.
Suggested Courses

721 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