Solved

How to attach a file to email?

Posted on 2001-09-12
6
336 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.

810 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