Unix pdf mail attachement error

Hi Experts...
I send a pdf file generated by a java file using a unix script which uses the following command to send the pdf file:
uuencode files sample.pdf | mailx -s "PDF Mail2" user@mailaddress

I receive the pdf file as an attachment in the mail but i get the error when i try to open the pdf attachment.
Please help...
sample-pdf.bmp
gaugetaAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
CEHJConnect With a Mentor Commented:
I don't think it's going to work any which way using mailx on further inspection, for the reasons Garry-G was enumerating. Since you're starting in Java, you may as well finish in Java and mail it with Java
0
 
CEHJCommented:
Are you able to open the pdf file before you encode and sent it?
0
 
gaugetaAuthor Commented:
@CEHJ:Yes i have FTP'd it to windows and it opens normally.
Only when i send using the above format i am not able to open it.
Please help...
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Garry GlendownConsulting and Network/Security SpecialistCommented:
Do not UUENCODE the file ... this will not work with (m)any "modern" email clients ...
Your best choice would be a MIME attachment, which you can't automatically generate with mailx ...
Instead, look into e.g. "metamail" - it contains a program named "metasend" which does what you want without requiring uuencoding (or mimencoding) the file first ... e.g.:

metasend -b -t destuser@mail.com -s "Th Mail Subject" -m application/pdf -f document.pdf

0
 
CEHJCommented:
You could try base64-encoding it using the -m option to uuencode...
0
 
gaugetaAuthor Commented:
@Garry-G & @CEHJ:Its throwing an error saying metasend command not found.
Please help...
0
 
CEHJCommented:
Well maybe you don't have that utility ;)
0
 
Garry GlendownConsulting and Network/Security SpecialistCommented:
Depending on your Unix flavor/distribution, you can either just use your packet distribution tool (apt, rpm, yast etc.) to install the binaries, or download the source & compile, eg. from http://ftp.gwdg.de/pub/misc/metamail/
0
 
gaugetaAuthor Commented:
@CEHJ:Would the syntax be as follows:
uuencode -m base64-encoding files sample.pdf | mailx -s "PDF Mail4" user@mailaddress as this is not working.
Please help...
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.