Priceless, it works on the server?
So this is functionality included in windows by default?

From: Joseph L. Casale [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 3:12 PM
To: NT System Admin Issues
Subject: RE: Processing eml files

That's just awesome, works perfect.
I didn't know CDO required OL 2007. So now I have to either install OL 2010 or 
07+CDO on the fileserver. I don't have a spare license of office, I thought I 
could get away with just the cdo install.
I may have to resort to some ugly hack like using a cli based decoder, or parse 
the eml for the base64 content and write it out...

Thanks Michael!
jlc


From: Michael B. Smith [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 11:51 AM
To: NT System Admin Issues
Subject: RE: Processing eml files

Well, that's not vbscript, that's vb.net (or vb6).

This is completely untested, but should be close. It's very similar to the vb 
code.

    $adTypeText = 2
    ...
    $objMail = New-Object -comobject "CDO.Message"
    $objStream = $objMail.GetStream()
    $objStream.type = $adTypeText
    $objStream.LoadFromFile( "c:\file.eml" )
    $objStream.Flush()
    ...
    foreach( $attach in $objMail.Attachments )
    {
        $attach.Name
    }
    ...
    $objStream.Close()
    $objStream = $null
    $objMail = $null

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: Joseph L. Casale [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 1:37 PM
To: NT System Admin Issues
Subject: RE: Processing eml files

Michael,
Sounds good to me then. The snippet of code I snagged for vb looks like:

Dim strm As ADODB.Stream
Dim myMail As New CDO.Message
strm = myMail.GetStream()
strm.Type = ADODB.StreamTypeEnum.adTypeText
strm.LoadFromFile("c:\file.eml")
strm.Flush()
Dim attach As IBodyPart
For Each attach In myMail.Attachments
MsgBox(attach.FileName)
Next

In trying to find something equivalent in ps, I am out of luck. As the io 
notify code is ps, I'd hate to start over, any pointers here for ps equivalents?
Thanks!
jlc

From: Michael B. Smith [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 11:07 AM
To: NT System Admin Issues
Subject: RE: Processing eml files

If I were doing it in PowerShell, I'd probably still use CDO.

That should work fine.

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com

From: Joseph L. Casale [mailto:[email protected]]
Sent: Tuesday, January 25, 2011 12:44 PM
To: NT System Admin Issues
Subject: Processing eml files

I need to load an eml file programmatically and strip the attachments, I was 
hoping to use PowerShell, but vb could work as well.
It will run on a 2008r2 server, the simplest example I could find was vb only 
and used CDO. If no one knows of a PowerShell way to do this, does anyone see 
anything wrong with installing CDO on a 2008r2 server and leveraging it to 
accomplish this?

Thanks!
jlc

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to