Solved

How to attach a file to email?

Posted on 2001-09-12
6
334 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now