greenmail-mail-test / greenmail

Official master for the Greenmail project
http://greenmail-mail-test.github.io/greenmail/
Apache License 2.0
639 stars 184 forks source link

IMAP Server - Messages are appended with wrong INTERNALDATE #211

Open Frolx opened 7 years ago

Frolx commented 7 years ago

Hello guys, I have an issue with GreenMail - IMAP server.

The messages that are appended to the GreenMail IMAP server using JavaMail Library, are stored with wrong INTERNALDATE.

The weird thing is that the issues occur between 12:00 PM - 1:00 PM.

Both the application in which GreenMail ran, and the client that appends the messages to the IMAP store, are in BST timezone. (I checked on UTC too)

I debugged the append operation until the messages are converted to bytes to be sent through IMAP protocol, the date / time is right but on IMAP server, the messages have incorrect INTERNALDATE.

e.g. If a message is appended at 12:33 PM, the INTERNALDATE of the message in the IMAP server will be: * 1 FETCH (INTERNALDATE "18-Jul-2017 00:33:30 +0100")

if a messages id appended at 13:21 the result will be : * 1 FETCH (INTERNALDATE "18-Jul-2017 13:31:55 +0100")

Maybe some of you had the same issue, thanks!

buildscientist commented 7 years ago

Hi @Frolx. Thanks for submitting the issue. I haven't seen this issue occur but then again I generally do not assert on specific times (just dates) for incoming emails.

Just to clarify - are you saying this issue occurs when a client sends in an email using BST OR UTC timezones?

Frolx commented 7 years ago

Do not send, just append using IMAP protocol. I tested on UTC and BST, in both cases result is the same.

randomsmith9 commented 2 years ago

I encountered this same thing which I think is a bug

Zone Brisbane GMT+10

Before Midday (11:21am) : note the two bold 11 am times 11:21:26.026 [imap:127.0.0.1:3143<-/127.0.0.1:58402] DEBUG c.i.greenmail.util.LineLoggingBuffer - C: A6 FETCH 2 (ENVELOPE INTERNALDATE RFC822.SIZE) 11:21:26.027 [imap:127.0.0.1:3143<-/127.0.0.1:58402] DEBUG c.i.greenmail.util.LineLoggingBuffer - S: * 2 FETCH (INTERNALDATE "06-Oct-2022 11:21:24 +1000" RFC822.SIZE 29 ENVELOPE ("Thu, 6 Oct 2022 11:21:24 +1000 (AEST)" "2 some sub[WRAP]

After midday (12:20pm) : note the two bold 00/12 pm times 12:20:52.245 [imap:127.0.0.1:3143<-/127.0.0.1:34382] DEBUG c.i.greenmail.util.LineLoggingBuffer - C: A10 FETCH 3 (ENVELOPE INTERNALDATE RFC822.SIZE) 12:20:52.245 [imap:127.0.0.1:3143<-/127.0.0.1:34382] DEBUG c.i.greenmail.util.LineLoggingBuffer - S: * 3 FETCH (INTERNALDATE "06-Oct-2022 00:20:51 +1000" RFC822.SIZE 29 ENVELOPE ("Thu, 6 Oct 2022 12:20:51 +1000 (AEST)" "EST-00001 [WRAP]

When current time is 12:20pm for ENVELOPE, the INTERNALDATE is being set as 00:20 which is midnight Testing against greenmail 1.6.11

marcelmay commented 2 years ago

Hi @randomsmith9