How to attach a file while sending email via mailx or mail?

I would like to attach a file while sending a email via a command line option in a bash script which is getting executed via cron every hour. Please let me know if there is a way to achieve this. Thanks!
beer9Asked:
Who is Participating?
 
omarfaridConnect With a Mentor Commented:
you can as well do

uuencode filename < filename | mailx -s "my subject" username@domain
0
 
woolmilkporcCommented:
Hi,
unfortunately it is not possible to send email attachments using the command line of mail or ¤ailx.
I'd suggest using 'mutt' instead.

Wmp

0
 
beer9Author Commented:
How Can I use 'mutt' for sending email with attachment :-)
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
woolmilkporcConnect With a Mentor Commented:
mutt -a [/path/to/attachment] -s "[subject]" [recipient@domain.tld]
The mail body can be included via normal redirection and/or by using the -i [/path/to/body.txt] parameter.
This is mutt's man page -
http://www.mutt.org/doc/man_page.html
 HTH
wmp
 
 
0
 
omarfaridCommented:
I am not sue which uuencode you are going to use, but the one in the script is using

--base64

which might not be supported in your version
0
 
gheistCommented:
You can add 8bit also. 99% of internet is able to cope with that.
0
 
woolmilkporcCommented:
Why not let 'mutt' do the job? And it's a fine mail client compared to 'mailx', btw.
mutt for Solaris 10 -
ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/mutt-1.5.19-sol10-sparc-local.gz
 
0
 
beer9Author Commented:
Thank you :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.