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
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 establish a connection between my mail server and a java program to parse the mail using protocol MAPI.. now the connection is working fine with a mock mailbox using IMAPS..but my mail server does not support MAPI..So is thr any option like JMAPI..
It seems like Java Supports POP3 and IMAP very well out of the box.
But for other protocols you can use one of the vendors found at JavaMail API - Third Party Products.
I've had problems communicating with the Novell Groupwise Protocol, luckily they have a IMAP bridge I could have used instead.
The Moonrug Exchange Connector looks like the one you are looking for, but you will have to purchase.
OpenMAPI looks like a promising one, but it is still in development.
JavaMail requires that you specify an external SMTP server when sending mail. I want to have my java app send email directly without having to use an external SMTP server such as postfix or sendmail.
Can anyone recommend a library which provides this kind of functionality?
Ive done some googling and have come up with nothing.
It's not trivial to send mail yourself. To start with, you have to deal with DNS (MX records), queuing, connection management and maybe signing (DKIM). So you wouldn't find any light-weight library like JavaMail to do this.
Your best bet is JAMES,
http://james.apache.org/
I want my Java application to send out emails to users. But I cant get a good solution.
Now, I got some on Google but they use a SMTP server which I dont have. I was wondering if setting up one on my Linux machine would be easy?
So, I am using mailx now to send out emails but it sends emails from root which is definately not good. Is there any way to send out emails from a proper email using java? like you can do in php and other languages?
Use commons-email to send email from java in a simple, straightforward way (see the docs).
You need an SMTP server always - even in "php and other languages", but perhaps you don't know you need it, because it is bundled in your LAMP package.
One solution is to use google as an SMTP server. Either via your account, or via google apps. Otherwise setting up an smtp server (postfix for example) linux appears trivial, but isn't - you have to take into consideration many things - see this post by Jeff Atwood.
So ultimately, I'd suggest using the options provided by google.
if you'r looking to host your own mail server, then apache james is a pretty good option.
or other solution could be using a third-party mailservers such as gmail or yahoo; and use the JavaMail API to send emails.
If you don't have an SMTP server, Asprin is a send-only SMTP server, which is a pretty good fit. It suffers from the same problem any do-it-yourself SMTP server will, in that it will look more like a Spam source, so using a proper SMTP server used for e-mail should be done if possible.
I am facing a problem regarding getting the drafts and sent mail folder programmaticaly in Java. Although I am able to get the inbox using pop3 and able to send mail via smtp, I am not able to get it done by pop3. Thanks in advance for your reply.
The POP3 Protocol doesn't support folders at all, so the only one you can get is the INBOX.
All the other folders are stored locally within each POP3 client, so if you are writing one, you are free to do that in whatever way you like.
There might be POP3 servers that allow use of folders through extensions, but in that case they are not following the standard protocol and you will most likely implement something own or try to find some package specific for that mailserver.
If you want to use server-side folders in a standardized way, I suggest you look at IMAP. Most mail-providers do support both POP3 and IMAP and it supports storing folders on the server (including Drafts, Sent mail, and other customized folders).
When I look at this I would say that the standard POP3 protocol implementation provided with JavaMail does not support this.
POP3 does not supports the notion of differents folder. If the mail server supports IMAP then you'd be able to access all folders. The IMAP support in JavaMail is decent and easy to use.