Retrieving emails from specific date - jakarta-mail

I'm trying to retrieve messages from a specific date using IMAP. (Yahoo mailbox )
This line should give me back nothing cause there are no new emails from this moment:
Message[] mlist = inbox.search(new ReceivedDateTerm(ComparisonTerm.GT, new Date()));
But insted it returns all of the messages in the folder Inbox.
Anyone now how fix it? I have tried every example I have found online and nothing worked so far... I don't want to go over mail by mail and check the received date...
Thanks

Do you have any messages received today? If so, you're probably running into this bug, plus the fact that IMAP date comparisons only consider the day, not the time. You can try the JavaMail 1.5.3 SNAPSHOT release, which fixes that bug. If that's not the problem, please post the debug output when this problem occurs, along with the received dates of messages in your folder.

Related

Delay in receiving emails

Currently, we are using one Gmail API to receive MFA through Email. We are using this in automated tests to read to code.Until yesterday we are receiving emails in seconds and we are able to read the code. But starting from today there is some delay in receiving an Email and sometimes the email is not been received.
Is there any way to check these logs? Can anyone help with this?
Well, if you experienced some delay, based on this documentation there can be a delay of several minutes if the user exceeds their quota. You can also try to use the Users.messages: get to get the specific message and check if it has some delay in receiving.
I found here a related SO question about your problem. So just check it if it can help you. It uses IMAP for this issue.

GMAIL API : How to get the reply without the original message

i'm using google api for gmail. All is working fine, i was able to connect, list and get message / thread, browse every elements of a thread etc...
I want to be able to retrieve a reply without the original message, is it somehow doable ?
I think that every email software will put together a different constructed reply message with the original message included but maybe there's a way to retrieve only the reply.
Thanks for any hint that will allow me to do such thing.
It appears the consensus is that this is not possible, and that the message/thread must be parsed manually with your program.

Getting unexpected results when processing email via App Engine app

I'm trying to set up the email receiver found here, to process incoming emails and send them out as POST data to a script on my server to be handled further from there. The issue I'm having is when I send one test email to foo#[myappname].appspotmail.com, the App Engine logs show that the email is continually "received" over and over again every couple of minutes, even though I only sent it once. Then after several minutes of this, when I go into settings and disable the app, I get at least one "Delivery to the following recipient failed permanently" message to the email account I was sending the emails from (makes sense, since the app is now disabled and not accepting any incoming mail).
What I'm having trouble understanding is why the application is behaving like it's getting multiple emails sent to it when it's only one. Do I need to modify the Python script to do something to delete or halt the email once it's been processed the first time? If so, does anyone have any suggestions as to how to do that? The Python script that I'm using is found here.
User voscausa answered my question-- the email requests kept retrying because the script was erroring. Thanks!

Javamail: how to fetch messages modified since a specific date

I'm writing an application that synchronize emails (inbox only) from an IMAP server. For that I'm using javamail and I have performance issue. When I want to refresh my emails, I fetch all messages in inbox, and it takes several minutes. :(
So I would like to fetch only messages that were modified since the last time I refreshed emails. I found how to fetch messages received or sent since a date, but what I want to do is slightly different. It is possible to change the state of a very old message (unread to read). In this case the modification date is recent but received or send date is old.
Any idea ?
Regards,
Quentin
You can't change the content of an old message, but you can change the flags. You can fetch all the flags for all messages and compare them with your cached copy of the flags. (There are IMAP extensions that help with this, but many IMAP servers don't support them and JavaMail doesn't support them.)
Use the Folder.fetch method to fetch all the flags in one operation, then iterate over the Message objects and compare the flags.

Constant disconnects due to channels going stale for no reason

Ever since the latest release a few days ago, our users are constantly being disconnected due to channel tokens going stale with minutes of being created. Our tokens are set to last for 5 hours, but we're lucky if they last for 5-10 minutes and we cannot even reconnect with a new channel token when the channel closes until the user refreshes.
A Javascript error triggers the beginning of it. It looks like this:
NetworkError: 400 Unknown SID - http://89.talkgadget.google.com/talkgadget/dch/bind?VER=8&clid=C9C2EFC06C7C5163&gsessionid&prop=data&token=AHRlWrrWl611ZMMDw8Apgi5vdYuS9UslofxEiJI47-2n4rkPgmuu1z0AN-UNQcyNEvhck-AYAMSLPru8Aumooz62hYNNbLTbi1a3lTSAzGEyj6TsXZirJYE&RID=rpc&SID=BEBDEFDA92C6A9F7&CI=0&AID=54&TYPE=xmlhttp&zx=gsjg8mb1i987&t=1
Then, in Firefox Firebug, the console gets spammed infinitely with
channel name mismatch; message ignored
Until a refresh occurs.
Our site is a real-time interactive site with chat. Our users are sending us emails upset that they keep getting disconnected. They're leaving the site. This is costing us not only goodwill with our user base, but also money and we are powerless to do anything because the bug is with Google App Engine.
Please fix this or rollback to the previous build immediately until you figure this out. The latest build is broken.
I haven't been able to reproduce this but I'm still looking at it. In the meantime: if you explicitly call socket.close() after receiving the error, can you then create a new Channel object and reconnect? If that doesn't work, you could even try manually removing the element with id "wcs-iframe" itself from the DOM. You should be able to use the original token when doing this instead of fetching a new token.

Resources