Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Unix pdf mail attachement error

Posted on 2011-09-16
9
Medium Priority
?
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 18

Expert Comment

by:Garry Glendown
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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 86

Expert Comment

by:CEHJ
ID: 36548890
You could try base64-encoding it using the -m option to uuencode...
0
 

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 18

Expert Comment

by:Garry Glendown
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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Utilizing an array to gracefully append to a list of EmailAddresses
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.
Suggested Courses

670 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