| Author |  | 
      
        | sukrw Newbie
 
  
 
 Joined: 08 February 2011
 Online Status: Offline
 Posts: 1
 | 
          Hi all,
           | Posted: 08 February 2011 at 12:42am | IP Logged |   |  
           | 
 |  
 I am hoping someone can help me with this. I am coding a mail client that syncs the emails to a local SQL DB.
 
 I need to retrieve the following fields back from the Mail Server: without downloading the entire email.
 
 Subject
 Date
 Size
 From
 To
 CC
 UniqueID
 MessageBody (text and html)
 Has Attachments (true/false)
 Attachment FileNames
 Attachment PartIDs
 Attachment Size
 
 It is the last 4 fields I am struggling with (Attachment info). I am hoping to be able to just download header information rather than the FULL Email as the emails will contain some large attachments and I don’t want the sync to take a long time. Hence the reason to get the PartID and filename for each attachment. I want to then be able to give the user  links to click if they want to pull down individual  attachments.
 
 If an email has 20 attachments, I don’t want to download all 20 files. I want the user to be able to select for example attachment4 (partID “4”) and to then go back to the Mail Server and download just that attachment.
 
 Is this possible?
 
 I have been using this:
 
 envelopes = imp.DownloadEnvelopes(MailBee.ImapMail.Imap.AllMessages, False, EnvelopeParts.MessagePreview Or EnvelopeParts.BodyStructure, -1)
 
 This was all fine until I added an email into the inbox with a 12MB attachment. It then took ages to get the envelopes. I am guessing it is pulling all the attachment information back using this method rather than just the header information?
 
 Can anyone help?
 
 Thanks
 
 sukrw
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          You supply -1 as the last parameter for DownloadEnvelopes, which means the message is
           | Posted: 08 February 2011 at 4:25am | IP Logged |   |  
           | 
 |  downloaded completely. Try supplying 0 instead, only envelopes will be obtained in that case.
 
 Hope this helps!
 
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |