Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Extracting Attachment Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
kazmax
Newbie
Newbie


Joined: 19 February 2006
Location: United Kingdom
Online Status: Offline
Posts: 8
Posted: 15 March 2009 at 9:44am | IP Logged Quote kazmax

Could some kind soul please give me a hint on how to do the following, if it is possible?

I'm using Pop3 to get an email from my mail server - working perfectly. The email has one attachment, which is defined as XML.

I can save the XML using the following:

MailMessage oMsg = Pop3.QuickDownloadMessage(...);

oMsg.Attachments[0].Save(...);

That works fine - I can then open the file just created in a text editor and read the XML.

However what I would really like to do is grab that XML from an email attachment and copy it straight into a string variable, so that I can then save the XML to a database.

I can obviously save to file and then grab the contents of the file with StreamReader, but I wondered whether there might be an elegant way of obtaining the XML straight from the MailBee object?

Andrew
Back to Top View kazmax's Profile Search for other posts by kazmax
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 16 March 2009 at 8:05am | IP Logged Quote Andrew

Attachment.GetData method allows you to get attachment data as a byte array.

You can then convert it to a string or open a stream reader, etc.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
kazmax
Newbie
Newbie


Joined: 19 February 2006
Location: United Kingdom
Online Status: Offline
Posts: 8
Posted: 16 March 2009 at 10:37am | IP Logged Quote kazmax

That sounds ideal - thanks!

Andrew
Back to Top View kazmax's Profile Search for other posts by kazmax
 
kazmax
Newbie
Newbie


Joined: 19 February 2006
Location: United Kingdom
Online Status: Offline
Posts: 8
Posted: 16 March 2009 at 11:22am | IP Logged Quote kazmax

I can confirm this works perfectly! Thanks again!

Andrew
Back to Top View kazmax's Profile Search for other posts by kazmax
 

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