I am during porting an application using IMAP and SMTP to communicate with mail server. At the beginning I planned to change only IMAP protocol to EWS API, but I am wondering is even makes sense/is possible? I mean, I would retrieve mails with EWS and perform actions like reply or archive with Java Mail API. The first complication is to map Object representing email message in EWS (EmailMessage) to analogue one in Java Mail API (Message). But even if I would able to, I am not sure if its reliable. In this case, should I port whole communication with mail server to EWS?
Best Regards!
It would probably be better if you could do it all with EWS or all with JavaMail.
If EWS can produce a MIME formatted byte stream for the message, you can use that to construct a JavaMail MimeMessage and then handle the rest with JavaMail, if you need to.
Related
I am not sure do i need to configure some mail server (like james) to send email from java api
like explained at this Java email send code example
No but its not a good idea.
When you want to use javax.mail session you need a mail server which accepts smtp connection from your app. This is preffered why.
But you could also write a socket based adapter which directly tries to deliver the mail to the receivers mail server by connecting by smtp and handle the protocol your self. That is theoreticaly, because most email server would not accept your application, because there spam protection will block you.
So my advice is. Don't think to much about this. Use a locale mailserver like james or one of the millions smtps proxies out there for development. And later in production change configuration to a well setup mailserver (most called MTA) where you can be sure that your mails will be delivered.
You do not need to set up one yourself. Mail providers, such as GMail and Outlook for instance, expose their own mail servers which you can use to transmit email messages.
Note however that in such cases, email transmission might eventually be blocked so as to discourage the delivery of SPAM mail.
yes :)
in this example it is installed at localhost, so mail is passed to another service within the same box. of course, you can use an external server, too - for example if you have a development system home, than utilize the mail server of your ISP.
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 looking for a java library to access(show) client's emails in a web app.
For instance user comes to the site, enters credentials, smtp and all this stuff (like when doing Import in Thunderbird or Outlook) and our website can show him his emails in the browser...
Are you aware of such library? Is this possible?
IIRC, JavaMail is mostly for sending emails but what I need is to access and list client's emails.
there many opensource client mail tools which can be coustomised as you need, please check below below
Client Emails Access
Update :
check this Chilkat
Here is a sample code how-to-create-an-e-mail-client-in-java
Yes Javamail can do exactly what you are asking. Javamail isn't for just sending emails. You can access a user's mailbox. Sending emails is over the SMTP protocol. Javamail supports SMTP, POP3, and IMAP. You're interested in POP3 or IMAP.
http://www.oracle.com/technetwork/java/javamail/index.html
How can i use the java mail api for showing mail from yahoo and rediff ?
I used the same code as with gmail mails but now it is giving the :
***javax.mail.AuthenticationFailedException***
You might want to have a look at what the java mail client columba does. The actual imap and pop clients are extracted into a subproject, that can be used independently from the app.
I want to make a program which can read email (subject, sender, body message) in Yahoo & Google mail.
I originally thought to use POP3 but I read on the internet POP3 can't read the mail box.
Does anyone know of / can suggest a Java library for this problem?
Peek here:
Getting mail from GMail into Java application using IMAP
Java itself provides Java Mail APIs to enable mail functionalities. You can also find third party APIs at here.
GMail provides an ATOM feed of unread mail that uses HTTP Basic authentication:
http://mail.google.com/mail/feed/atom