Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET POP3

 AfterLogic Forum : MailBee.NET POP3
Subject Topic: winmail.dat files Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hr-pb
Newbie
Newbie


Joined: 06 December 2008
Online Status: Offline
Posts: 12
Posted: 02 June 2009 at 4:18am | IP Logged Quote hr-pb

Hi,
how to extract attachments from TNEF containers into AttachmentCollection using GetAttachmentsFromTnef method and then treat them like any other attachments ?
Back to Top View hr-pb's Profile Search for other posts by hr-pb
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6044
Posted: 02 June 2009 at 4:41am | IP Logged Quote Igor

Not sure we understood the problem. Please take a look at the following code (found here):

Code:
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\mstnef.eml");
foreach (Attachment attach in msg.Attachments)
{
    if (attach.IsTnef)
    {
        attach.GetAttachmentsFromTnef().SaveAll(@"C:\Temp");
    }
}


This code loads message from file, retrieves all the attachments found in message, every attachment is analyzed and in case if it's TNEF attachment, its content is extracted with GetAttachmentsFromTnef method, so you get attachments collection you can process the way you need.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
hr-pb
Newbie
Newbie


Joined: 06 December 2008
Online Status: Offline
Posts: 12
Posted: 02 June 2009 at 5:57am | IP Logged Quote hr-pb

hmmm...
I have file winmail.dat , I need to extract attachments from this file, but I don't want save them all at once.I need to save one by one.
Back to Top View hr-pb's Profile Search for other posts by hr-pb
 
hr-pb
Newbie
Newbie


Joined: 06 December 2008
Online Status: Offline
Posts: 12
Posted: 02 June 2009 at 5:58am | IP Logged Quote hr-pb

here :
http://www.afterlogic.com/mailbee_net/docs/MailBee.Mime.Atta chment.IsTnef.html

"(...)However, MailBee allows the developer to extract attachments from TNEF containers into AttachmentCollection using GetAttachmentsFromTnef method and then treat them like any other attachments"
Back to Top View hr-pb's Profile Search for other posts by hr-pb
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6044
Posted: 02 June 2009 at 6:49am | IP Logged Quote Igor

Well, using SaveAll was just an example of what you can do with attachment collection. If you need to process them one by one, you can do it as follows:

Code:
MailMessage msg = new MailMessage();
msg.LoadMessage(@"C:\Docs\mstnef.eml");
foreach (Attachment attach in msg.Attachments)
{
    if (attach.IsTnef)
    {
        AttachmentCollection coll = attach.GetAttachmentsFromTnef();
        foreach (Attachment att in coll)
        {
        // e.g.:
        // att.Save(@"C:\Temp\" + att.Filename, true);
        }       
    }
}


--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
hr-pb
Newbie
Newbie


Joined: 06 December 2008
Online Status: Offline
Posts: 12
Posted: 02 June 2009 at 6:51am | IP Logged Quote hr-pb

thx
Back to Top View hr-pb's Profile Search for other posts by hr-pb
 
hr-pb
Newbie
Newbie


Joined: 06 December 2008
Online Status: Offline
Posts: 12
Posted: 16 June 2009 at 3:26am | IP Logged Quote hr-pb

I have mail with winmail.dat file...I have error message : "Unexpected end of TNEF stream",how to resolve this problem ?

my code :

if (attach.IsTnef)
    {
        AttachmentCollection coll = attach.GetAttachmentsFromTnef();//error
}      
Back to Top View hr-pb's Profile Search for other posts by hr-pb
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6044
Posted: 16 June 2009 at 3:32am | IP Logged Quote Igor

In order to let us help you on this, please provide us with the email message you're trying to process.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide