Author |
|
Naresh Newbie
Joined: 12 April 2007 Location: India
Online Status: Offline Posts: 9
|
Posted: 30 April 2007 at 7:19am | IP Logged
|
|
|
Hello,
I am trying to fetch inbox using IMAP protocol. Everything is working fine except From.DisplayName property.
I am seeing blank value for From.Display property.
I am using following code to retrieve all the messages from Inbox folder.
Dim envelopes As EnvelopeCollection
envelopes = imp.DownloadEnvelopes(MailBee.ImapMail.Imap.AllMessages, False, EnvelopeParts.MailBeeEnvelope Or EnvelopeParts.BodyStructure, 0)
Regards,
Naresh
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 30 April 2007 at 9:25am | IP Logged
|
|
|
Are you using Envelope.From or MailMessage.From? I guess it's Envelope.From since you're not requesting EnvelopeParts.MessagePreview. If that's correct, the problem may occur due to the following reasons:
- none of e-mails whose envelopes you're downloading have display names in From. That's normal.
- your IMAP server does not support display names in email addresses.
If you're sure display names should be there, you may try to get them by requesting EnvelopeParts.MessagePreview and then examining envelope.MessagePreview.From.DisplayName.
Obviously, envelope.MessagePreview.From.DisplayName should be equal to envelope.From.DisplayName. However, sometimes it's not so. This is because envelopes are already returned by the IMAP server with display names separated from email address themselves (in other words, the mail server itself parses email address string, founds display name and pure email address, and returns them as separate values). For MailMessage, it's MailBee's job to parse email addresses because the mail server does not parse email messages and returns them as raw data. Thus, if your mail server cannot parse email addresses, envelope.From.DisplayName will be empty. At the same time, since MailBee can parse email addresses, envelope.MessagePreview.From.DisplayName will be non-empty.
BTW, if you request EnvelopeParts.MessagePreview, there is no need to download entire messages. Downloading message header only is enough:
Code:
envelopes = imp.DownloadEnvelopes(MailBee.ImapMail.Imap.AllMessages, False, EnvelopeParts.MailBeeEnvelope Or EnvelopeParts.BodyStructure Or
EnvelopeParts.MessagePreview, 0)
|
|
|
Regards,
Alex
|
Back to Top |
|
|