Link to home
Start Free TrialLog in
Avatar of snazzyrags
snazzyrags

asked on

How to attach a file to email?

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.
Avatar of filiep
filiep

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.
you can try the following.

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

Post your comments.

Kidambi
ASKER CERTIFIED SOLUTION
Avatar of chris_calabrese
chris_calabrese

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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.
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