A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Process E-mail attachements



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 16th 08, 03:13 AM posted to microsoft.public.outlook.program_vba
Question Boy
external usenet poster
 
Posts: 20
Default Process E-mail attachements

Hello,

I have an e-mail with over 300 attachments (.eml format). I would need some
serious help to loop through each attachment file Grab the body content and
save it as a Text file with a unique filename.

Originally I was going to save the eml file and use them but they have the
same name (don't ask) so I'd have to rename each attachment manually which is
just not doable with the quatity at hand.

Thank you for your guidance,

QB
  #2  
Old May 17th 08, 05:16 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Process E-mail attachements

What is the exact problem that you are having? Saving an attachment?
Processing it?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Question Boy" wrote in message
...
Hello,

I have an e-mail with over 300 attachments (.eml format). I would need
some
serious help to loop through each attachment file Grab the body content
and
save it as a Text file with a unique filename.

Originally I was going to save the eml file and use them but they have the
same name (don't ask) so I'd have to rename each attachment manually which
is
just not doable with the quatity at hand.

Thank you for your guidance,

QB



  #3  
Old May 19th 08, 01:52 PM posted to microsoft.public.outlook.program_vba
Homr Zodyssey
external usenet poster
 
Posts: 1
Default Process E-mail attachements

I'm having a similar dilemma, I think.

I received a dozen emails. Each of them has a dozen more emails as
attachments (.eml files). Each of these has multiple attachmetns that are
files like PDFs, CSVs, etc.

I'm having trouble accessing the attachments of the attachments using VBA.
  #4  
Old May 19th 08, 07:48 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Process E-mail attachements

You would need to first convert the EML files (which Outlook does not
understand natively) to regular messages.
There is nothing in OOM that can help you. Outlook 2002 and higher expose
IConverterSEssion object that can be used for conversion in Extended MAPI
(C++ or Delphi only).
plug
you can use Redemption to import EML files to Outlook (see
SafeMailItem.Import) or (if you do not want the temporary messages in
Outlook) you can create temporary standalone MSG files and import EML files:

set Session = CreateObject("Redemption.RDOSession")

set Msg = Session.CreateMessageFromMsgFile("c:\temp\test.msg ", "IPM.Note",
1)

Msg.Import "c:\Temp\attach.eml", 1024

Msg.Save

MsgBox Msg.Attachments.Count



/plug

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Homr Zodyssey" Homr wrote in message
news
I'm having a similar dilemma, I think.

I received a dozen emails. Each of them has a dozen more emails as
attachments (.eml files). Each of these has multiple attachmetns that are
files like PDFs, CSVs, etc.

I'm having trouble accessing the attachments of the attachments using VBA.



  #5  
Old May 29th 08, 05:46 PM posted to microsoft.public.outlook.program_vba
Homr Zodyssey[_2_]
external usenet poster
 
Posts: 1
Default Process E-mail attachements


I misspoke when I said they were EML files. They were MSG files. I ended
up fixing the problem by saving each MSG file to disk then opening it.

Sub saveAttachments(mitem As MailItem)
Dim att_mitem As MailItem
Dim new_fname As String

For i = 1 To mitem.Attachments.Count
Select Case mitem.Attachments.item(i).Type
Case olByValue
fileCount = fileCount + 1
new_fname = "C:\attachments\" & Right("0000" & fileCount, 4)
& "." & Right(mitem.Attachments.item(i).FileName, 3)
LogMessage (vbTab & mitem.Attachments.item(i).FileName & "
-- " & new_fname)
mitem.Attachments.item(i).SaveAsFile (new_fname)
Case olEmbeddeditem
mitem.Attachments.item(i).SaveAsFile
("C:\attachments\tmp.msg")
Set att_mitem =
Application.CreateItemFromTemplate("C:\attachments \tmp.msg")
LogMessage ("**" & vbTab & att_mitem.Subject)
saveAttachments att_mitem
End Select
Next

End Sub

"Dmitry Streblechenko" wrote:

You would need to first convert the EML files (which Outlook does not
understand natively) to regular messages.
There is nothing in OOM that can help you. Outlook 2002 and higher expose
IConverterSEssion object that can be used for conversion in Extended MAPI
(C++ or Delphi only).
plug
you can use Redemption to import EML files to Outlook (see
SafeMailItem.Import) or (if you do not want the temporary messages in
Outlook) you can create temporary standalone MSG files and import EML files:

set Session = CreateObject("Redemption.RDOSession")

set Msg = Session.CreateMessageFromMsgFile("c:\temp\test.msg ", "IPM.Note",
1)

Msg.Import "c:\Temp\attach.eml", 1024

Msg.Save

MsgBox Msg.Attachments.Count



/plug

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Homr Zodyssey" Homr wrote in message
news
I'm having a similar dilemma, I think.

I received a dozen emails. Each of them has a dozen more emails as
attachments (.eml files). Each of these has multiple attachmetns that are
files like PDFs, CSVs, etc.

I'm having trouble accessing the attachments of the attachments using VBA.




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Outlook from process other than Outlook process Wassim Dagash Add-ins for Outlook 2 January 16th 07 06:28 PM
How can I get rules to process before junk e-mail filter? rshiras Outlook and VBA 0 December 12th 06 04:49 PM
How can I get rules to process before Junk E-mail filter? Rob Shiras Add-ins for Outlook 0 December 12th 06 04:48 PM
Attachements in Body of Mail - Possible? Scooby Jones Outlook - General Queries 3 September 19th 06 05:33 PM
Only when i forward emails with attachements "550 relaying mail to" [domain] "is not allowed" Alchemy Outlook - General Queries 4 March 8th 06 11:47 PM


All times are GMT +1. The time now is 06:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.