0 votes
by (120 points)

Hello Rebex team,

I am evaluating the product Rebex Secure Mail in the hope to register it.
I find no possibility to get the 'ReceivedDate' if I retrieve the headers from a email using POP3.

I use the method:
'Pop3MessageInfo messageInfo = popClient.GetMessageInfo(1, Pop3ListFields.FullHeaders)'
Only the 'Date' property I can get.

However I retrieve the email headers using IMAP I get the 'Date' and the 'ReceivedDate'

Is there a way to get the receiving date from a POP3 mail without to retrieve the complete mail?
Or is this planned in future versions?

Thanks

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (144k points)
edited by

Update: ReceivedDate property has been added to Pop3MessageInfo in Rebex Secure Mail 2016 R2.


The ReceivedDate value is not part of the message itself. It's only a part of the IMAP protocol's message metadata (it's actually called INTERNALDATE). The POP3 protocol doesn't provide any equivalent functionality, which unfortunately means that it's not possible to retrieve this using POP3 clients.

However, it is possible to retrieve a date from the topmost Received header, which should more-or-less correspond to the ReceivedDate obtained using Imap.GetMessageInfo. The MailMessage object can be used to easily parse the headers and return the desired date:

Pop3MessageInfo info = pop3.GetMessageInfo(sequenceNumber, Pop3ListFields.FullHeaders);

var mail = new MailMessage();
foreach (MimeHeader header in info.Headers)
{
    if (header.Name == "Received")
        mail.Headers.Add(header);
}
MailDateTime receivedDate = mail.ReceivedDate;
...