Author |
|
kazmax Newbie
Joined: 19 February 2006 Location: United Kingdom
Online Status: Offline Posts: 8
|
Posted: 15 March 2009 at 9:44am | IP Logged
|
|
|
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 |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 16 March 2009 at 8:05am | IP Logged
|
|
|
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 |
|
|
kazmax Newbie
Joined: 19 February 2006 Location: United Kingdom
Online Status: Offline Posts: 8
|
Posted: 16 March 2009 at 10:37am | IP Logged
|
|
|
That sounds ideal - thanks!
Andrew
|
Back to Top |
|
|
kazmax Newbie
Joined: 19 February 2006 Location: United Kingdom
Online Status: Offline Posts: 8
|
Posted: 16 March 2009 at 11:22am | IP Logged
|
|
|
I can confirm this works perfectly! Thanks again!
Andrew
|
Back to Top |
|
|