[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

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
0
gaugeta
Asked:
gaugeta
  • 4
  • 3
  • 2
1 Solution
 
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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
CEHJCommented:
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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now