uuencode problem


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users uuencode problem
# 8  
Old 07-10-2011
probably the issue is the file doesn't show as an attachment. it lacks MIME section maybe.

Try these last two posts:
https://www.unix.com/hp-ux/41306-send...ugh-mailx.html
# 9  
Old 07-15-2011
Curleb, Your explanation is great. I tried that way but the mailx is making the trouble. In fact I downloaded the generated .xls file (simply tab delimited fields) and ms excel could open fine. But mailx is making it a mess. The email body gets the junk dump
begin 640 /home/asutoshch/test.20110715.xls
M1DQ47TY"4@E&3%1?3$-,7T]224=?1$%410E/4DE'7T%24%0)1$535%]!4E!4
M"5-#2$5$7TQ#3%]$15!?1$%410E30TA%1%],0TQ?1$507U1)344)5$%)3%].
M0E()4U1!4E])3D0)24Y"3U5.1%]&3%1?3D)2"4E.0D]53D1?1DQ47T%24E]$
M051%"4E.0D]53D1?1DQ47T%24E]424U%"C,S-`DQ-"U*54PM,C`Q,0E/34$)
# 10  
Old 07-18-2011
Assuming that these ".csv" files are in standard unix text file format and contain only printable ASCII characters.

Needs a bit of work to change the variable names (avoid variable names starting with numbers), remove the absolute path from the filenames, convert the file to MSDOS format and keep the target filenames valid in MSDOS. Also add the "-m" switch to mailx (a weird HP-UX feature).

I realise that changing the filenames may ripple back up the script but we must bear in mind that this is SNMP and we should keep it simple. Also many virus scanners will eat a filename containing a double file extention.

Code:
OUT_1="`date +%Y%m%d`_1.csv"
OUT_2="`date +%Y%m%d`_2.csv"
cd "${WORKDIR}"
( ux2dos ${OUT_1} | uuencode ${OUT_1} ; ux2dos ${OUT_2} | uuencode ${OUT_2} ) | mailx -m -s "Attachments are in standard format" <emailid>


When working the two attachments should appear as proper attachments.


I've assumed you are using a standard HP-UX Posix Shell or Korn Shell. Variable names like ${1_OUT} are not valid in this context and should be giving you runtine errors.

Last edited by methyl; 07-18-2011 at 01:37 PM..
# 11  
Old 07-20-2011
I hope that works for you (it's working in HP-UX)

Code:
File=/home/dir1/dir2/file.csv (whole path of the file)

mailx -s "name of the file"  destination@domain.com << EOF

Hi,

here the attached file :

~< ! uuencode ${File} `basename ${File}`




created by "Your NAME"
~.
EOF

# 12  
Old 07-20-2011
Another possible way

Here's the basic logic we use to send csv formatted files to Outlook (ksh on Solaris) maybe it will work for you.

Code:
#!/bin/ksh

MAILBODY="This is the body of the e-mail"

# set_example.ksh is a unix shell script that gets sent as an attachment.
unix2dos -437 -ascii set_example.ksh attach.out
if (( $? != 0 ))
  then print "$0: unix2dos failed"
       exit 1
fi

(print $MAILBODY; uuencode attach.out set_example.txt) | mailx -s "mail test9" your_id@your_company.com
if (( $? != 0 ))
  then print "$0: uuencode or mailx failed"
       exit 2
fi

exit 0

# 13  
Old 07-21-2011
On hpux mailx needs the -m option for attached stuff...as shown by methyl
# 14  
Old 07-31-2011
Thank you. I am able to do it by html programming from shell script. The excel sheet can be opened sucessfully every time sent. Thank you all for your guidance.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with uuencode

Hi, I am trying to send an attachment through UNIX to the mail box. But along with the attachments I am also receiving junk data as a text file, Suppose "Hi" is the subject of the mailx command then along with the attachment I am getting Hi.txt also. Below are the commands which I used : - ... (15 Replies)
Discussion started by: Alex_Smith
15 Replies

2. Shell Programming and Scripting

mailx, uuencode problem

I've this command to run ... Purpose : Send attachment file with e-mail body... ( E-mail body i read it from text file) uuencode TEST_FILE.csv TEST_FILE.csv | cat /usr/local/bin/EMAIL_BODY.txt - | mailx -s "TEST Report" -c receiver1@mail.com receiver2@mail.com Here is the... (2 Replies)
Discussion started by: prash184u
2 Replies

3. Shell Programming and Scripting

problem with uuencode

Hi everyone, I'm emailing a spool file to a person using mailx. I'm using uuencode to attach the file to the email. but am getting this error uuencode: ISO8859-15 to 646 conversion: Invalid argument Any ideas as to why. The code is below sqlplus -s user/password@database <<EOF set... (9 Replies)
Discussion started by: rjsha1
9 Replies

4. Shell Programming and Scripting

Problem with uuencode

i used below code to attach a file but it's not attaching the file but sendinf a simple mail uuencode ${discord_file} mail_list.txt | mailx -s "TEST MAIL" xxx@yahoo.com (3 Replies)
Discussion started by: punitpa
3 Replies

5. Shell Programming and Scripting

Uuencode

Hi All, I have a queryin the uuencode option. Actually i need to attach two files in a single mail. I am aware of attaching a single file using the command below. (echo " The first file ";uuencode file1 file1) | mailx -s " The files " venkidhadha@in.com However i am not sure what... (6 Replies)
Discussion started by: venkidhadha
6 Replies

6. UNIX Desktop Questions & Answers

uuencode for attachment giving problem

Hi All, I am using unix's sendmail utility to send mails with attacments. I am using the uuencode command for attachments (zip). When i send the mails to some account which is configured in the MS outook it opens/unzip the attachments with no problem. But the same attachments seems to be... (3 Replies)
Discussion started by: manojram
3 Replies

7. Solaris

uuencode and mailx problem

We are running solaris 9. I can send emails using mailx with no problems. I can send attachments using uuencode no problems. What I can't do is change the name to .txt or .doc or anything else using uuencode. The command I am using is: uuencode /tmp/AsetReports /tmp/AsetReports.doc | mailx -s... (2 Replies)
Discussion started by: zeekstern
2 Replies

8. Shell Programming and Scripting

Problem with uuencode

I a script i telnet port 25 and part of the attachment is echo "Content-type: application/msword; filename= "$3" " echo Content-transfer-encoding: base64 echo "Content-disposition: attachment; filename= "$3" " echo uuencode -m "$3" /dev/stdout $3 is a word document. When i send... (0 Replies)
Discussion started by: markms
0 Replies

9. UNIX for Dummies Questions & Answers

Uuencode problem in mail attachment

I have a unix script that compresses a .txt file using gzip command and then sends it by mail using uuencode. This has been working fine for some time, but lately I've been experiencing some problems, as when I open the mail generated, I don't see the attachment, but instead I get a large amount... (8 Replies)
Discussion started by: mvalonso
8 Replies

10. Shell Programming and Scripting

uuencode

hi all, I dont know of this is a duplicate thread, but the thread i started a while ago wasnot posted still. ok my question is i have a shell script named "mail_editck.sh". i have to include some reports in it so that i can get the email when they are done. the syntax goes like this. ... (2 Replies)
Discussion started by: tejasingaraju17
2 Replies
Login or Register to Ask a Question