Solaris / OpenSolarisThis forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i used your first code seems working, but i got attachment properly but file is not intact, the lines are all grambled. and csv file is totally messed up. Do we have any option for that...
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Well, I dunno -- I just sent the file mailit.sh to myself at both gamil.com and my local machine (note that mailx does not like dealing with zipped files and the attachment will be unreadable -- with a mail app, like Thunderbird, the attachment can be saved and unzipped). Note that zipping means that the attachment will be mailto.sh.zip, not just mailto.sh.
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
OK, take a look at the man page for mailx -- is there a -a option? If so, that's how to do an attachment. The "old" mailx on Solaris didn't support attachments (no -a) and the uuencode I gave would work with that but not, apparently, with a mailx that does have the -a option. Sigh.
So, if you do have a newer mailx that has the -a, you do it like this
Code:
# we need to zip the file
# get the filename without any path information
FILE=`basename ${1}.zip`
# zip it
# (otherwise use gzip -c ${1} > ${FILE}.gz)
zip ${FILE} ${1}
# compose a little message
echo "Attached is ${FILE}." > /tmp/message
mailx -a ${FILE} -c who@where -s "Here is ${FILE}" who@where < /tmp/message
rm ${FILE} /tmp/message
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541
Rep:
Well, that ought to work -- but, seems like I remember (it's been a while) that zip wasn't all that hot on Solaris... do you have gzip available (and, of course, does whoever you're sending to?).
I fiddled with it some some and got it to actually work like it would on Solaris with
Code:
# we need to zip the file
# get the filename without any path information
FILE=`basename ${1}`
# zip it
# (otheriwise us gzip -c ${1} > ${FILE}.gz)
zip ${FILE}.zip ${1}
# compose a little message
echo "Attached is ${FILE}.zip." > /tmp/message
cat ${FILE}.zip | uuencode ${FILE}.zip | mailx -s "Here is ${FILE}.zip" -c who@where sombody@somwhere < /tmp/message
rm ${FILE}.zip /tmp/message
Realize that you will not be able to deal with the attachment in mailx -- gotta use Thunderbird or some other web-based mail client.
I've mailed three different CSV files to myself, got 'em in Thunderbird, upzipped them and got back what I expected.
This is about the only thing I can think of to do other than, maybe, use Thunderbird as your mailer and attach pre-zipped (or gzipped) files using it from your Solaris box. Thunderbird does (or at least is used to) build on Solaris and that might be an answer (might even be a Solaris package for it).
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
Rep:
Quote:
Originally Posted by tronayne
Thunderbird does (or at least is used to) build on Solaris and that might be an answer (might even be a Solaris package for it).
Thunderbird is included in Solaris 10 update 4 (August 2007) and newer.
Otherwise, many builds are downloadable from here http://www.sunfreeware.com/mozilla.html
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.