Extract latest incoming email message body from an reply email - java

We have created a method for extracting incoming email attachments while reading the incoming emails from the s3 storage and we are using JavaMail API of version 1.6.2 for it. We need to get the latest message from the email without the previous correspondence. Currently, we are using MimeMessageParser to extract the incoming email data. How do we get only the new response text? We are using java version 1.6 and spring version 4.1.4.RELEASE. I have done so many searches but failed. If anybody knows a good standard way please help me.

Related

Send mail (Java vs Php)

I have developed an app with a login. To help users I would like to send a mail reminding their credentials.. 2 solutions but 2 problems:
1) If I send the mail from the mobile phone (using my gmail account and mail.jar library) Google always reports a possible violation of my account or a suspect access, blocking it. I read several forum page about remove this feature but some people say that Gmail is built to be used by a single person
2) If I send a mail from a php page (using the function mail($mailto,$subject,$message,$header) several mail server put automatically this email into the trash folder.
Any suggestion? How to solve this issue?
Thank you in advance
You could send mail in java (mail.jar or mailServices of Spring Framework). I suggest you to use a mail provider service to send mail. It's better because there many things to care with when you send email ( email does not exist, delay of receiving the email, the current status of email sent, received or read...)

How to parse outlook email using spring

I have a use case where i need to read the content of the mail in outlook inbox and convert it into xml and send it to diffrent system.Is there any library which can help me in parsing the content.
Outlook is the client for the email server.(May be exchange server).
You actually need to connect to the server to read the email.
If you know the server, you can find a API for it.
Checkout this URL if you are trying to access the exchange server:
http://archive.msdn.microsoft.com/ewsjavaapi

Thunderbird api to send a mail via Java

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.

Auto Generated Mail

Perhaps this kind of question comes under not to ask category but for the sake of application I have to ask.So pardon me.
At the time of Log in,I found that(suppose)If I am unable to remember my password,then I have to put my email-id then an auto generated reply come from that's hosted site with
a new link for generating another new password or
simply sending password(that means password isn't encrypted,I guess) in reply.
watching the source code it's hard to predict,but I want to know(if they are using jsp) then which protocol is used for this auto generated mail what are the other things to remember to achive this, while I'm also making an application for auto generated mail.
I have done this using javax.mail api in java
google for sending mail using java...
define content of mail in template or resource file and send mail whenever user clicks on forgot password link.
It is using SMTP protocol only.

How to retrieve email body of any email, using Java Mail API

I am developing a Mail Client in Java (JSP and Struts). I have successfully fetched Message header information and stored in my local Database (including Message ID and subject).
When the user views the mails, I fetch the message headers from my database and display them to user. Now when the user click a particular Email, I want to fetch the mail body and file attachments from the Gmail server, directly. I don't want to serially travel through all the mails on the Gmail Server.
I have done this earlier in PHP, where if I pass the message id and I can retrieve the details of that particular mail. Is there any similar functionality in Java Mail API? If not, then can anyone suggest me a solution to this?
You can use Folder#getMessage(int) for this.
Note that the zip file with the JavaMail API which you can download from their side includes a lot of examples in /demo folder, under each a basic(!) Servlet which shows a simple mailbox with this functionality. You may want to build, refactor and expand further based on the simple example.

Categories