Hi everyone,
does anybody already have a converter line for fulltext indexing and previewing eml files? I would like to import some mail files to seeddms. I tried just to use the same lines as for txt - it works, but i get the complete header of the mail in the preview and the fulltext index. I would like to have a rendered preview. I now found HMonArc, which converts eml to html. Now i can use unoconv to convert html to pdf, and the result is exactly what i want. But i did not manage to get the converter line to execute multiple commands in one line. I have to admit that i am not that strong at bash scripting, so maybe there is some error in the line:
What i planed to do: create a html file from the importet eml, save it to some temp location. Then let unoconv create a pdf out of that html file, and - if also possible - remove the temp file.
I also tested pandoc, which should directly do the conversion from eml to pdf, but obvisously it needs a latex library to work which is some 100mb in size. And i am running seeddms on a small rasperry, so if possible, i would like to not use this huge package. But if there is no other way, i may do it anyway...
Thanks for the help
Tobias
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you run your command on bash level, does it work and you get the PDF? Don't know if that works with the previewer in this case, Uwe will for sure be able to answer this part.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
mhonarc doesn't seem to be the right tool. As far as I know it doesn't create a single html file but creates some files on disk. I personally would write some php script which takes apart the mail and feeds its parts to indexer.
If you want to chain various programms you have to use a pipe, e.g. cmd1 | cmd2 | cmd3 > '%o'
The first command in that rows also takes it input from stdin through a pipe.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With the -rcfile i can even use a template for the conversion, so i can hide headers i do not want to have in the pdf preview.
I tried piping, but obviously mhonarc does not support pipe output. I did not get this to work, even on the command line.
The problem with the multiple files is only occuring when you give mhonarc multiple eml files as input. Then it creates some index files. If you only want to convert one eml, you also have to use the "-single " parameter, with that only one file is created.
I could also remove the part where i define the output file for mhonarc - this way a file named "msg00000.html" would be created in the working directory - which is www/op, and in my eyes creating temp files in web sources directory is even more ugly then the solution i got now, so i used this temp folder solution.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What about Apache Tika (https://tika.apache.org/0.9/formats.html)? I use Tika to index Microsoft-Office-documents and it should work for some emails as well
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Uwe: i tried your converter command, it does not work. It creates a file in the corresponding cache folder, but the file can not be opened, even if i download it and open try with pdf Reader. MHonArc documentation does only talk about getting piped input, but i realy believe that MHonArc does not like getting piped itself...
@Mee: thanks for the tip, i never heard of Tika and will definitely take a look at it. For now i'm happy, i have a - ugly but working - solution and i can import and preview mail files.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
does anybody already have a converter line for fulltext indexing and previewing eml files? I would like to import some mail files to seeddms. I tried just to use the same lines as for txt - it works, but i get the complete header of the mail in the preview and the fulltext index. I would like to have a rendered preview. I now found HMonArc, which converts eml to html. Now i can use unoconv to convert html to pdf, and the result is exactly what i want. But i did not manage to get the converter line to execute multiple commands in one line. I have to admit that i am not that strong at bash scripting, so maybe there is some error in the line:
What i planed to do: create a html file from the importet eml, save it to some temp location. Then let unoconv create a pdf out of that html file, and - if also possible - remove the temp file.
I also tested pandoc, which should directly do the conversion from eml to pdf, but obvisously it needs a latex library to work which is some 100mb in size. And i am running seeddms on a small rasperry, so if possible, i would like to not use this huge package. But if there is no other way, i may do it anyway...
Thanks for the help
Tobias
If you run your command on bash level, does it work and you get the PDF? Don't know if that works with the previewer in this case, Uwe will for sure be able to answer this part.
mhonarc doesn't seem to be the right tool. As far as I know it doesn't create a single html file but creates some files on disk. I personally would write some php script which takes apart the mail and feeds its parts to indexer.
If you want to chain various programms you have to use a pipe, e.g. cmd1 | cmd2 | cmd3 > '%o'
The first command in that rows also takes it input from stdin through a pipe.
Thanks Daniel and Uwe for your messages.
After some more test commands, i found a line that converts tp eml file to pdf. It's not the best solution, but it works:
'message/rfc822' => "mhonarc -rcfile /var/data/eml_conv_resource.mrc -single '%f' > /home/www-data/_temp/msg.html && unoconv -d document -f pdf --stdout -v /home/www-data/_temp/msg.html > '%o' && rm /home/www-data/_temp/msg.html"With the -rcfile i can even use a template for the conversion, so i can hide headers i do not want to have in the pdf preview.
I tried piping, but obviously mhonarc does not support pipe output. I did not get this to work, even on the command line.
The problem with the multiple files is only occuring when you give mhonarc multiple eml files as input. Then it creates some index files. If you only want to convert one eml, you also have to use the "-single " parameter, with that only one file is created.
I could also remove the part where i define the output file for mhonarc - this way a file named "msg00000.html" would be created in the working directory - which is www/op, and in my eyes creating temp files in web sources directory is even more ugly then the solution i got now, so i used this temp folder solution.
Try
mhonarc -rcfile /var/data/eml_conv_resource.mrc -single '%f' | unoconv -d document -f pdf --stdout --stdin > '%o'
It doesn't need the temp. file.
What about Apache Tika (https://tika.apache.org/0.9/formats.html)? I use Tika to index Microsoft-Office-documents and it should work for some emails as well
@Uwe: i tried your converter command, it does not work. It creates a file in the corresponding cache folder, but the file can not be opened, even if i download it and open try with pdf Reader. MHonArc documentation does only talk about getting piped input, but i realy believe that MHonArc does not like getting piped itself...
@Mee: thanks for the tip, i never heard of Tika and will definitely take a look at it. For now i'm happy, i have a - ugly but working - solution and i can import and preview mail files.