Pushing a mail include to a java program - java

I have a Windows Server that recives mail. These mail contains only 1 single CSV file. I want my server to automatically take the attachment from any incoming mail and send to a java program locally installed. Is there anyone who can give me directions on any programs that fix this or do I need to create some kind of windows service?
Thankful for any help!

=>Write a program using threads and run in the Windows Server
=>Your thread will check a particular location (where the CSV will be stored) for every 5 minutes (give your own time interval of checking)
=>Process that file.
Hope this helps.

How do you receive the mail (service,script,application)? If you do via Outlook, things are pretty easy. Write a VBA script which extracts the attachment and saves in a folder somewhere. In the java application you implement a directory listener which fires if the directory has changed and pick up the new file.

Related

automatic download from server to my server

a supplier of mine delivers his price list with a link like this:
http://www.example.com/report?cad1=104516005&cad2=da97172291f241855399358471275b38
If using a browser, you go to this address, the server generates a excel report on the fly and a "Save as..." dialog appears so you can download it, like this:
I was told to make a cron job, so the file would be transfered to my server automatically every day, and I really don't know if that's even posible.
I tried using java's HttpURLConnection, but I get a "503 Forbidden" message when I try to connect to that URL, plus, the file itself doesn't really exist on the server, and if it exists, I don't know the location of the file.
I also tried using linux wget, but it returns the html from this address (http://www.example.com/report) instead of the excel file that is generated.
Is there a way to do this using java or any other thing that can be executed as a cron job?
I no longer need an answer for this. The requirements changed.
I'm answering the question since I cannot delete it.

Java link to view a specific email from the PST file in outlook

I have learned coding in JAVA for the sole purpose of creating a task manager where I can create tasks and keep all my files, phone calls and emails for the specific task in one place, or rather easily accessible from within the task. I have had success with all requirements but for the email. What I want to achieve is to have a "link" in my java program to a specific email in the PST file and when the link/button is clicked the email must be opened and viewed in Outlook.
I have tried Javamail and I can successfully access emails from the server - however I get too many emails per day and have to delete all emails from the server twice daily. The PST file seems like the best solution - it already has all the information I need without creating duplicates.
I have tried libpst and I can access all of my emails in the PST file with success. However, I cannot seem to pick one email and have it open in Outlook. Since I will use this program only to make my job easier I would prefer not to have to buy any "connectors" and the like - I could just as well then buy a program like this and where is the fun in that?
Any suggestions would be greatly appreciated.
Did you look into using the Outlook Object Model? COM libraries can be accessed in Java using Jacob. To open a message in Outlook by its entry id, use Application.Session.GetItemFromID.
I am not sure if this would work since I havent used the libpst library. Can you export a single email message as a .eml or .msg file? If you can, then you can open the file using outlook easily enough.
This snippet should help
Desktop desktop=Desktop.getDesktop();
desktop.open(<.eml/.msg file>);
Also, take a look the switches available to open outlook from the command prompt.
http://office.microsoft.com/en-in/outlook-help/command-line-switches-HP001003110.aspx

run a java class file using php

I have java class file (server.class) I want to run this file to client machine using php.
My approach
download the file from server to client machine
run this file in client machine
close the cmd and delete the file after on pressing another button
tell me my approach is right or I am making it more complex.If it is complex the then suggest me what is the right approach?
You cannot run programs on a client's machine. You can provide a download link and instructions on how to run it.
If you want to avoid the client having to click a download button, all I can think of is implementing server.class as an applet inside a web page or maybe using webstart, but I don't know much about webstart, and either way the client will go through a process of agreeing to run the java code.
Also, it sounds like some shady, shady stuff you're attempting to do. I hope you're not trying to run something on a person's computer without them knowing. If that is the case... I WILL find you :P

Alert on FTP file server upload

How to scan network directories / or a FTP server and alert me via email each day saying what new files have been upload to the server?
I have about 20+ directories at work with images that get updated by external parties, but rarely get told that they put the files there. Would make things easier if I had an alert along those lines.
In dotNet you can use the FileSystemWatcher class to get notified when new files arrive or when files change: FileSystemWatcher on MSDN
If you need a quick and easy solution you can use the freeware FTP Guard which provides exactly the functionality you describe.
Just schedule it to run e.g. every morning and you will have the information you need.

In java web application how to print server file from client side

In the java web application need to select the file from server and print to the local printer. how it can be done
Thanks in advance
That's going to be tricky whenever you require a minimum of user interaction (i.e. just click the link and then do the print magic) and it also depends on the type of the file in question. If it is for example a .doc file, then you would basically need to download it to the client environment and open it in the default associated application (MS Word in this case) and then let the application execute the print command. You can't do this from the server side on.
Your best bet is to create an Applet which in turn displays the file tree, downloads the file to the local disk file system on client interaction and makes use of Desktop#print() to print it. E.g.
File file = new File("/temp/file.doc");
// Read file from server using URLConnection, write it to this file and then do:
Desktop.print(file);
But if it are for example plain text files such as text/html, text/xml, etcetera, then you can make use Javascript to load the file into some <div> or <iframe> element and then execute the window.print() method on it, if necessary along with a CSS media rule.
You will need an applet, flash, silverlight, javafx - i.e. an embedded app. There:
download the file from the server by creating a GET request (in an applet - using URL.openConnection()), obtaining the returned bytes and forming an in-memory document
sending that to a printer. If you chose applet - this might help
(I'm not aware whether the same flow can't be achieved with javascript as well)

Categories

Resources