Solved

Unix pdf mail attachement error

Posted on 2011-09-16
9
337 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:gaugeta
  • 4
  • 3
  • 2
9 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 36548845
Are you able to open the pdf file before you encode and sent it?
0
 

Author Comment

by:gaugeta
ID: 36548861
@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
 
LVL 17

Expert Comment

by:Garry-G
ID: 36548872
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 36548890
You could try base64-encoding it using the -m option to uuencode...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:gaugeta
ID: 36548900
@Garry-G & @CEHJ:Its throwing an error saying metasend command not found.
Please help...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36548919
Well maybe you don't have that utility ;)
0
 
LVL 17

Expert Comment

by:Garry-G
ID: 36548933
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
 

Author Comment

by:gaugeta
ID: 36548946
@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
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 36550375
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

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now