How add message to inbox folder from java app? Right now to do this i use the same FROM and TO addresses (javamail -> smtp). Mail server is remote (Exchange), so i cant get access to it file system.
If your mail server is Exchange 2007 or Higher, I'd look into EWSJavaAPI Microsoft made a nice interface to all of the Exchange Web Services calls (no messing with dirty dirty SOAP)
Related
we are switching from Lotus notes to Outlook 2013 and I'm working on a POC to connect to the Microsoft Exchange. I'm confused on which API to use to connect. Requirement:Basically I need to write Java Application to read inbox and get attachments and move the email to a different folder and in that folder I have to delete emails that are n days old.
Is EWS microsoft recommended? do we have support for bugs, updates etc
Can JavaMail Api be used to connect to Microsoft Exchange server.?
Can this(Requirement) be done thru reading the local .OST file, if yes how to read and can I move emails to different folder in .OST file.
Any help or suggestions on which API or method will be good in long run.
Yes, EWS is the preferred API to access Exchange Server
Not a good idea - JavaMail supports POP3/SMTP/IMAP4 standards. These are supported by Exchange, but EWS provides a lot more Exchange specific functionality.
You can use Outlook Object Model (COM based).
I am trying to get emails from Microsoft Exchange server using EWSJ API which in terms uses Exchange Web Services; but I would like to know; will it be fast to fetch emails using IMAP?
Since we have GWT we cannot directly connect to Exchange from client side in either case; we want to minimize the turn around time of getting emails on server side and then passing those to client side using serialized POJOs.
Apache Hupa is a subproject of the Apache James project, and it is a webmail client developed with GWT, it uses a server side able to get messages from any IMAP enabled server (it uses the javax.mail api).
Although you can use directly Hupa to read and send emails using your email server (there is a properties file to define imap and smtp parameters), in your case you could get the server side to connect to your servers and use any GWT ajax mechanism to get the messages like Hupa client side does.
Here you have a live demo of Hupa.
From my experience IMAP seems to be the fastest at the moment. I used it once to create a small program that could fetch emails from GMail. A bonus is that you can mark emails as "read" from the IMAP interface.
If I had to choose I'd go for IMAP.
I am trying send the email using java mail API and want to enable the option "Do not Forward" under permission (in outlook 2007) while sending email. Can you please suggest me some pointers to do it?
I dont want the user to forward , print copy the email .
is there any attribute setting for this ? (e.g. to send mail with high priority x-priority is used)
Thanks
There is no support for the MS Exchange Information Rights Management settings within MAPI or SMTP. These are Outlook/Exchange centric settings, and you would have to write something using their object model (which I believe is all COM / .Net based with no direct Java access other than via JNI). Furthermore, if you are sending these message to non-outlook clients, it won't matter. E.g. Gmail is not going to prevent
I am building a web application that has to be able to do the following:
Send emails to the (external) addresses registered by the users (say, Gmail, Yahoo Mail, etc).
Send/receive emails to local mailboxes that live in the application. These are more "messages" in that sense.
What are the potential open source technologies I could integrate with here? Thanks for your inputs.
So, you want a SMTP server? If you want to have it in Java, then I can suggest to pick Apache James. But in fact every decent SMTP server would suffice. You can just use JavaMail API, or the more convenienced Apache Commons Email which is built on top of JavaMail API, to talk with any SMTP server to send/read emails.
If you didn't already realize, you can also just make use of an existing SMTP server provided by your ISP or the web hosting. In this case only JavaMail or Commons Email would have been sufficient.
While Commons Email will help you get the sending part done, receiving email will require that you access mailboxes via IMAP or POP through the Java Mail API.
Java Mail is a little cumbersome to use, but this Stackoverflow question has a working IMAP sample to help you get started.
There is a JCA (Java Connector Architecture) adapter that makes your Java EE server open port 25 for receiving mails.
http://sourceforge.net/projects/mailra/
A quite old tutorial which is incomplete with some examples for IMAP watching can be found here:
https://community.jboss.org/wiki/InboundJavaMail
A general introduction to JCA can be found here:
http://www.adam-bien.com/roller/abien/entry/a_simple_transactional_file_jca
Are there any open source email clients in java that you can recommend?
Something that pulls in emails via pop, sends emails, stores sent emails, etc.
Similar to what mozilla thunderbird does, but on build using jsp etc. for the web.
(preferably web based, but would also be interested in desktop apps)
I can point you at Davmail, its not a java smtp server or a desktop client, but its an outlook gateway that implements itself as a smtp/pop3 server. So you can put Thunderbird on your desktop and use it (via davmail) to access Exchange.
Works really well, but the code is available if you want to see some smtp/pop3/emaily-type code.