Is anyone aware of a way to retrieve and send mails by talking directly to the GroupWise server.
I want to be able to retrieve mail using Java if possible.
I wrote a Outlook Plug-In that retrieved mail out of GroupWise via the Groupwise Outloop Plug-in (If that makes sense).
Then dropped the message in a directory where I retrieved it with a Java App.
The problem is that I cannot add more than one GroupWise account in Outlook and need to.
I had a look at this question, but would like to know if there is a Java API
that will allow me to retrieve/send mail from the GroupWise server in a JavaMail like manner.
Thanks.
GroupWise allows mails to be retrieved using IMAP and POP3 which are standard supported by JavaMail. (And outlook too for that matter)
Sending mail should also be possible using smtp.
If it is for plain email I prefer to use these basic proptocols like smtp, pop3 and imap because they work almost everywhere, anytime and on any platform. They are less feature rich than the proprietary protocols, but that point is often not very relevant since many of these features are only meaningful for a subset of the mailclients out there.
Related
How can I extract extract emails and attachments using an API from a SMTP (Mail) server?
I was trying to figure out how Posterous worked. I found this open source project but it had no source code.
https://code.google.com/p/os-posterous/
The scope of your question is a little too broad, but yes, there are many APIs available for extracting email content and attachments. It is actually pretty simple to do in most programming languages (though javascript has nothing to do with this). You could look at MailGun, AWS Simple Mail just to name a couple or you could roll your own. You don't need to create an SMTP server for this, just access an email address programmatically, scan the contents of new messages and perform some logic on the content/attachments/etc.
Python: http://docs.python.org/2/library/imaplib.html
PHP: http://us2.php.net/imap
Ruby: http://www.ruby-doc.org/stdlib-2.0.0/libdoc/net/imap/rdoc/Net/IMAP.html
Java: https://javamail.java.net/nonav/docs/api/com/sun/mail/imap/IMAPStore.html
For Posterous I wrote a service in Java which connected to a mail server over IMAP and parsed incoming emails, attachments, etc. The JavaMail framework makes it super simple to do this.
I have been using Java mail API to send mails generated through the Java program. What I want to do now is to send a mail through Thunderbird mail client so that the mail get saved to the sent items folder of the user and the user can resend a mail if it has failed.
I also would like to know if it's possible to get a delivery report in the Java mail API.
Edit
I found out that our mail server is POP3 and it doesn't store mail. So is it a good idea to send another mail to the sender as well and define a rule that categorize those messages?
even if you send it with the java mail api (well gmail at least), you will still be able to see in the sent folder using thunderbird. as a matter of fact, 5 minutes ago, I saw this using a website that I build. I am sending emails using Java API, and when I check the send folder I can see them.
The InBox / Outbox in Thunderbird are normally mapped ti your IMAP-Account. The IMAP-Account is set on a mail server. All your mails and folders are stored on that mail server. the client (Thunderbird) only shows the contant from the server. By remote calls (IMAP-protocol) you can create/delete/edit/move folders and mails on the server. Sending a mail is not part of IMAP. Here you use the SMTP-Protocol. When you configure a mailaccount in Thunderbird you must configure IMAP & SMTP. When you send a mail Thunderbird does the following steps:
- Send Mail by SMTP-Protocol
- Create Mail in Outbox by IMAP-Protocol
SMTP & IMAP are totally different. But if you want to send a mail and see this mail in your outbox you must use both. You can program the same workflow with the java mail api.
If I get your question right, you are looking for a way to trigger mail sending via Mozilla Thunderbird from a Java program (an external program / software running on the same local machine).
You can achieve that via different methods:
calling the Thunderbird binary with command-line arguments
via SimpleMAPI, which Thunderbird supports
via XPCOM, also built into Thunderbird
What you won't be able to achieve easily is getting feedback from Thunderbird about the outcome of triggering / prompting the user to send a mail. But you could achieve that by using more difficult ways of integrating Thunderbird with your external software:
read and parse the actual MBOX inbox / mail sent / profile files in a user's profile. "using the X-Mozilla-Status headers (you could) figure out if a message is a new message (etc). A mbox file is essentially just a flat text file that has a seperator between the messages" (parentheses by me, source)
Write a bridging WebExtension Thunderbird Add-On that integrates in some way with your software. An extension has, via Thunderbird's WebExtensions API, essentially a hook for every feature Thunderbird has and your code Add-On could expose these internals in some way to your software.
AFAIK and sadly Thunderbird, as it ships, exposes no API or similar interface out of the box.
I want to be able to send an email to an email address, and then have it appear on a web page. Is this possible?
My guess is you'd have to write your own email server, something which I am not capable of doing. So I am assuming this won't be possible for me.
But if there is some way it can be done, that would be great. I generally program in Java and use Tomcat as my app server.
No, you wouldn't have to run your own SMTP server. You'd simply need to be able to retrieve mail from a POP3 or IMAP server, using something like the mail client API found in javax.mail.
It would be up to you to decide how much control you'd give to users. For example, who specifies the IMAP settings? Who decides which messages to fetch and display? Maybe that's all pre-configured. Maybe you write full-featured, web-based email client that can send messages as well as retrieve. This is all determined through the design of your web application.
You don't need to write your own mail server. You can use an ordinary (external) mail server and poll its inbox via POP3 or IMAP from your software. This introduces a short delay up to the full poll interval, but that might or might not be acceptable for you.
I can't give you a good tip for a email client lib to use for that, though.
Here is a simple example of sending email trough Google's SMTP server.
I'm embarrased of how I'm unaware of SMTP / POP3 / IMAP protocols,
as much as I thought I know HTTP and TCP/IP it apears that I took email as granted, and never had to write any piece of code that will do other than sending an email via an existing SMTP server.
My task is to write an incomming email channel and I would like to hear what is the basic aproach
What I need is the ability to listen to a specific email address, and capture the body, subject and attachment of that email for further processing.
I understand you want to programatically recieve mail...use subethasmtp (much lighter and easier than james etc, works very well.
If you want your server to receive e-mails, it's an SMTP server that you need.
(You'll also need to make sure that the e-mail address is set up to be sent to that server, via the MX entry in the DNS.)
Note that, depending on how you want to install this service, you might not need to write an SMTP server yourself (or even use a library). Existing SMTP servers are often capable of delegating the processing of an e-mail to external applications.
You could use somelike Postfix and configure it to use pipe for that address, to send the e-mail to process to the program of your choice (including one that you develop yourself). I'm fairly sure Exim, Sendmail and other MTAs have similar features.
With this sort of configuration, your application would usually need to be able to read the e-mail from the standard input (and have the ability to split/process headers and body), but that's usually much simpler that writing an MTA/SMTP server.
If you really want tighter integration with the MTA, perhaps this could be a good starting point (I've never tried it): http://james.apache.org/
An SMTP server is usually how you'd refer to an outbound mail server; it sends mail.
POP and IMAP allow you to connect to a mail server, to read the mail that's already been received.
You need the receiving/server side of SMTP, and you might benefit from reading up on MTA; mail transfer agent.
You might also be interested in reading about SMTP proxies; so, sent mail would go through your server - and could be filtered/listened to, I suppose - and then get sent further to it's actual recipient.
Use the JavaMail API
I am doing an Android application and I want to get the last 25 sent mails from a certain email account.
For Gmail I might use http://g4j.sourceforge.net/ and there is Mail Web Service API for Yahoo at http://developer.yahoo.com/mail/.
But I couldn't find something to do it with Hotmail.
Do you know if it is possible?
Also I am worried of having so many dependencies. I don't know if I should do something like https://sourceforge.net/projects/mrpostman/ and do web scraping.
You can download (or maybe upload) emails in various ways when using different email providers. My experience with the following providers is:
Yahoo:
POP3: Only available for Plus users (paid service). No get new messages, no folder access, no sent mail; just fetch all inbox (or all email UIDs). UPDATE: Yahoo provides free POP access and forwarding for Yahoo Asia users.
Mail Web Service API: Only listing email headers for Free users but complete access, including fetch mail from sent folder, for Plus users (paid service again). Of course, you are paid a commission by Yahoo if you can encourage (force) users to buy the Plus service if you are not sued before that by Yahoo lawyers because it is stated in the Web Service documentation that: "You may not use the Yahoo! Mail Web Service API to display the user's Yahoo! account information in a third party email client".
Web Scraping: It seems the only available solution for Free users of Yahoo but be aware of the compatibility problems that may arise when Yahoo changes its web pages. Also make sure to delay link accesses because Yahoo has web scraping detection mechanism on its servers.
GMail:
IMAPv4: Available for all users. Make sure to use this protocol for accessing almost everything in GMail. It is implemented completely; you can access all incoming and sent mails and even send an email by saving it in the sent folder. You can use JavaMail or any other IMAP client library in Java such as Ristretto API to do this. Make sure to know the JavaMail limitations before starting to use it for any protocol. It has many limitations (and minor bugs) in all protocols (SMTP/POP3/IMAP).
POP3: Available for all users of GMail but not recommended because of POP3 inherent limitations (no folder, no get new messages).
Hotmail:
POP3: Available for all users but again POP3 inherent limitations (no folder, no sent mail, no get new messages) in addition to Hotmail limitation called 15-minutes-delay-necessary for POP3 access.
Web Scraping: It seems the only solution for accessing sent mail but again be aware of the compatibility problems that may arise when Microsoft changes Hotmail web pages and web scraping detection software which may exist.
General IMAPv4 Provider:
In general, not all IMAP providers support sent folder because it is not a standard IMAP folder but most of them do this. Take a look at the provider's Help or FAQ for this option.
Genral POP3 Provider:
Do not expect POP3 to do this because POP3 does its best not to crash both the client and server when fetching 2 new emails from inbox ;-)
Meanwhile, do not forget that Web Scraping has legal issues and is forbidden in most web sites.
In our company's webapp, we use JavaMail to send mail through gmail account (very easy to use and powerful API). On JavaMail third-party product page I found project JDAVMail. It provides access method for WebDAV based protocol services. Maybe it'll be useful for you.
And, for Android: javamail-android
Why don't you just use either the built-in email facilities or standard access methods over IMAP? I guess using a separate lib for every provider won't work well in practice.
Google has its Mail application as open source.
https://android.googlesource.com/platform/packages/apps/Email
You might be able to utilize some of the source code yourself.