I'm searching the web for days now and didn't find any solution. Also there is no solution in my other question about OLE.
Is it possible, to create an E-Mail for Outlook, fill in stuff (body, subject) and show it for the user to view so he can click send hisself?
If it is possible, how. What APIs/Frameworks or Libraries are ther which support this. And ist der an SSCCE to view?
I can't get SWT (eclipse) to work. Not with the newest version, it always shows an error. I use x64 and Outlook 2013. To view my error watch here: How to create an E-Mail in Outlook and make it visible for the User
I hope somebody knows how this could be done, or just give me the answer it's not possible, so I can stop searching.
Thank you.
Edit
I have to use Outlook, because it's the E-Mail Tool used in my company. And I don't want to send it automatically but the user needs to view the E-Mail and send it manually.
Email is just a text. Sometimes it is formatted as a simple HTML page. So, you can use any HTML viewer to view email content. If you are working on desktop application note that Swing components support simple HTML (version 1.0 or so). If you are working on web based application you can show email text into div, iframe etc.
If you want to call default email client from your java application use Desktop.mail(URI). Take a look on this discussion.
BTW is seems we are using different google. I typed "call email client from java app" and immediately found the mentioned SO discussion.
EDIT
I think that your question was not exactly correct. Outlook is just one of various email clients. Well, very popular. But still one of... It is not guaranteed that it is installed on user's machine. So, you cannot require from java application to run Outlook. However you can run default email client.
Related
I have worked with Java in the past but have never created a visual user interface, only programs that read from the command line. I would like to create an interface that displays a box with text stating the required input on the left and on the right a blank text field that can be read from by the program. This is for a web app I am working on at my internship, I have very little guidance and would really appreciate any help as I am completely lost at this point. The program currently only reads line by line which is obviously unacceptable for a web app.
Thank you so much for any assistance you can offer.
You can use the browser as your user interface. Create an HTML file to create your form for the user to enter data (which they view in a browser like Google Chrome) and submit back to your app. JSP files are the java equivalent of HTML files with optional java code inside. Download the Eclipse IDE and the Tomcat server and run one of the tutorials for creating a web app. Here's a link to start: https://eclipse.org/webtools/community/tutorials/BuildJ2EEWebApp/BuildJ2EEWebApp.html
I know my question is more likely to be discussed rather than really answered (because it's very large), but I need some elements and "advices" to really get started, sorry for that.
So I've got a java program which has to analyse some URLs, I've finished this part. For the moment, the user has to enter manually the link into my program, then the link is analysed.
Now I have to retrieve automatically those links, which will be sent to me via e-mail. (In a special Gmail inbox created for that purpose)
So I need to :
Let my Java program "listen" to my inbox
Extract the link of any new mail in order to analyse it
There are many problems, according to the way I choose to access to my inbox (POP3, GMail API...), according to the frequency my application would check the inbox, maybe there would be authentification problems... Even how to let my application run as a "daemon"...
And I really don't know how to get started, which choices to make etc.
Any help is welcome of course, if you have any documentation or else. Thank you in advance.
You have several ways of doing this.
I suggest you using Java Mail, that has a simple and useful API.
You have some documentation and examples in this URL:
https://java.net/projects/javamail/pages/Home#Samples
Look at the class monitor (very bad name!!!) inside the examples. This class monitor a mail box for new emails.
I have an HTML form that I want a user to fill out, and then send by pressing a button. Is there a way to have that button run a java program with all the HTML input as parameters? I looked into this a bit, and most people recommended servlets. Is there a way to do this without a servlet?
Edit: I'm not trying to use a servlet because of restrictions.
If you have a restriction against running a servlet you're pretty much out of luck in terms of using java. You could use a JSP, but that's just a servlet at the end of the day. You could use javascript to pop-up a mail-to with the form parameters entered as the body of the email but that would assume the user has a mail program configured. You could use some service like http://www.emailmeform.com/ (I have no idea if this one is good, I just googled it...).
Check out Java Web Start, might be what you're looking for.
Are you running the java client-side or server-side? The two posted answers are client-side answers. As for server-side, the tutorial here might help, depending on your server.
I have a Java program which generates a PDF file. I want the user to click a button to open the default email client ready to send the PDF as an attachment. The two standard ways of opening the default email client have problems:
Java 6 doesn't seem to allow for attachments in the generated message
JDIC has a bug which prevents Outlook 2007 from sending the message correctly: http://jdic.dev.java.net/issues/show_bug.cgi?id=160
Can anyone suggest a way to do this?
Thanks
JDIC provides some functionality to do this. Although much of JDIC was absorbed into java.awt.Desktop in Java 6, it didn't include the email composition bits. Unfortunately the JDIC binaries disappeared with the transition of java.net to the Kenai platform; I uploaded the most recent versions I could find to the project JIRA.
JDIC doesn't play well in OSGi, so I recently extracted the relevant MAPI bits into a bundle called jmapi.
(I posted this answer to another question too.)
Did javax.mail.internet.MimeMultipart go away? That's sort of the canonical way to set up an attachment.
Update
Okay, so if I've got this straight, you want to know how to let your application use an unspecified email client on an unspecified operating system to send a multipart MIME email containing an undefined attachment but not by constructing the MIME message yourself?
... well, okay, I guess you mentioned Outlook so it must be Windows. But still.
Is there a specific reason you'd like to use the default e-mail client, rather than sent it from Java using the e-mail client (JavaMail)?
Can you provide more details as to the kind of application you're trying to write? I take it this is a client GUI application (Swing/SWT/AWT), but beyond that, I think we're going to need more details.
I'd like to encourage our users of our RCP application to send the problem details to our support department. To this end, I've added a "Contact support" widget to our standard error dialogue.
I've managed to use URI headers to send a stacktrace using Java 6's JDIC call: Desktop.getDesktop().mail(java.net.URI). This will fire up the user's mail client, ready for them to add their comments, and hit send.
I like firing up the email client, because it's what the user is used to, it tells support a whole lot about the user (sigs, contact details etc) and I don't really want to ship with Java Mail.
What I'd like to do is attach the log file and the stacktrace as a file, so there is no maximum length requirement, and the user sees a nice clean looking email, and the support department has a lot more information to work with.
Can I do this with the approach I'm taking? Or is there a better way?
Edit:
I'm in an OSGi context, so bundling JDIC would be necessary. If possible, I'd like to ship with as few dependencies as possible, and bundling up the JDIC for multiple platforms does not sound fun, especially for such a small feature.
JavaMail may be suitable, but for the fact that this will be on desktops of our corporate clients. The setup/discovery of configuration would have to be transparent, automatic and reliable. Regarding JavaMail, configuration seems to be manual only. Is this the case?
The answer I like most is using the Desktop.open() for an *.eml file. Unfortunately Outlook Express (rather than Outlook) opens eml files. I have no idea if this is usual or default to have Windows configured for to open EML files like this. Is this usual? Or is there another text based format that a) is easy to generate, b) opens by default in the same email client as users would be using already?
You could save a temporary .eml file, and Desktop.getDesktop().open(emlFile)
Edit: As you point out, this will unfortunately open outlook express instead of outlook.
However if you have Windows Live Mail installed, it will use that.
If you're using JDK 6 (you really should), the Desktop API is now part of the JRE. See http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/ for more information.
As a completely different way of handling the same problem, we use a bug tracker with an XML-RPC interface, and our (RCP also, btw) app talks to that using a custom submission dialogue. It means we can send the log files to help diagnose the problem, without the user having to find them.
I'm sure most bug trackers have something like this available. We use Jira, and it works great (apparently, they've just released a free Personal version that makes it easy to try).
Using that method, you can set the subject line and body text with a URI like
mailto:me#here.com?SUBJECT=Support mail&BODY=This is a support mail
However, the length of the subject and body text will have some limitation
There is no way I can think of to attatch a file using this method or something similar (without adding javamail to your app)
JDIC may not always be available on your user's platform. A good way to do this is to use the javamail API. You can send a multi-part e-mail message as explained in this tutorial by SUN:
Sending Attachments
import java.awt.Desktop;
import java.io.File;
import java.net.URI;
public class TestMail {
public static void main(String[] args) {
try {
Runtime.getRuntime().exec(
new String[] {"rundll32", "url.dll,FileProtocolHandler",
"mailto:a#a.de?subject=someSubject&cc=a#a.de&bcc=a#a.de&body=someBodyText&Attach=c:\\test\\test.doc"}, null
);
} catch (Exception e) {
e.printStackTrace();
}
}
}