Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,


I have one difficulty here with my Shell script. I want to send four text files and one csv file as attachment using mail or mailx and uuencode utility on Solaris server.
It is Sun Microsystems SunOS 5.10
Here is my code
( uuencode "file1.txt" "file1.txt" ; "file2.txt" "file2.txt" ; "file3.txt" "file3.txt" ; "file4.txt" "file4.txt" ; "file5.txt" "file5.txt"  )  | mailx -s "Subject" someone@abc.com < ~/maiBodytext.txt

Now the problem is, mailx is sending a mail but without any attachment.
I tried lot and googled too. But could not find the solution.

Is it the case that we cannot send attachment from SunOs cause i tried sending single attachment too, it failed.

Please note, both the script and the files are under same location i.e. my home directory.
Also, this script works on other Solaris box which has same version as SunOs 5.10 but it is from Oracle Corp. Does vendor specification matters. As far as i know, Oracle has took over Sun long back, then why there is this difference.

Please help me with this.

Thanks in advance!
Posted
Updated 17-Dec-13 22:58pm
v2

Try something like:
cat file1.txt file2.txt | uuencode | mailx -s "Subject" someone@abc.com < ~/mailBodytext.txt

See also:
http://unixhelp.ed.ac.uk/CGI/man-cgi?uuencode[^]
http://unixhelp.ed.ac.uk/CGI/man-cgi?mailx[^]
 
Share this answer
 
Comments
SanketAB 18-Dec-13 6:40am    
I am sorry my friend, but it did not work. I got Usage error for uuencode
Something like this:
Usage: uuencode [-m] [infile] remotefile

And the links, i have an idea about man pages for uuencode and mailx.
Thanks for reply!
If you find some solution please let me know
Richard MacCutchan 18-Dec-13 7:44am    
Sorry, but that was a best guess. It's quite a few years since I did any Solaris scripting.
Hey i found the workaround on this. Following is what now working for me
( cat mailBody.txt; uuencode "abc.txt" "abc.txt"; uuencode "xyz.txt" "xyz.txt"; uuencode abc.csv abc.csv ) | mailx -s "attach test" someone@abc.com
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900