Email attachments automatisch opslaan?

Forum over Homeseer scripts (DUTCH forum)

Moderators: TANE, Ruud

Post Reply
DJF3
Advanced Member
Advanced Member
Posts: 895
Joined: Thu Jul 12, 2007 9:28 am
Contact:

Email attachments automatisch opslaan?

Post by DJF3 »

Hi,

Is het mogelijk om attachments van bepaalde emails automatisch te saven?

Ik heb bijv. bepaalde status informatie die via email binnenkomt. Deze status informatie wil ik gebruiken in een HS device.
Deze informatie staat in een .csv of .txt attachment van een bepaald email account dat ik heb.

-Hoe kan ik attachments van HS 'monitored' email addresses saven op een vaste locatie?


Groeten
DJ
User avatar
Fantic
Member
Member
Posts: 201
Joined: Sat Feb 21, 2009 2:11 pm
Location: Loenen, UT, Netherlands
Contact:

Re: Email attachments automatisch opslaan?

Post by Fantic »

Je kunt in de meeste email clients een actie uit laten voeren gebaseerd op diverse criteria als een mail binnenkomt.
Je daar (afhankelijk van de mail client) natuurlijk ook een Save attachment actie laten uitvoeren.
Regards, Maarten.
Never let a computer know you're in a hurry.
pleaseask
Member
Member
Posts: 84
Joined: Fri May 23, 2008 9:33 pm
Location: Netherlands

Re: Email attachments automatisch opslaan?

Post by pleaseask »

Hi DJF3,

Yes that is possible.
Here is a sample vbscript that i have found on the internet couple of years ago.
I hope it is usefull

Edwin

'Description: To be used in 'stripping' attachments from
'e-mails in your inbox and save them to a hardcoded path.
'------------------------------------------------------
'This bit of code will strip attachments and save them into the path
'"C:\temp\Outlook Attachments", it has no error handling so be warned!
'Code starts (placed under a command button.)

Dim oApp As Outlook.Application
Dim oNameSpace As NameSpace
Dim oFolder As MAPIFolder
Dim oMailItem As Object
Dim sMessage As String

Set oApp = New Outlook.Application
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox)

For Each oMailItem In oFolder.Items
With oMailItem
If oMailItem.Attachments.Count > 0 Then '?
oMailItem.Attachments.Item(1).SaveAsFile "C:\Temp\Outlook
Attachments\" & oMailItem.Attachments.Item(1).filename
MsgBox oMailItem.Attachments.Item(1).DisplayName & " was
saved as " & oMailItem.Attachments.Item(1).filename
End If
End With
Next oMailItem

Set oMailItem = Nothing
Set oFolder = Nothing
Set oNameSpace = Nothing
Set oApp = Nothing
DJF3 wrote:Hi,

Is het mogelijk om attachments van bepaalde emails automatisch te saven?

Ik heb bijv. bepaalde status informatie die via email binnenkomt. Deze status informatie wil ik gebruiken in een HS device.
Deze informatie staat in een .csv of .txt attachment van een bepaald email account dat ik heb.

-Hoe kan ik attachments van HS 'monitored' email addresses saven op een vaste locatie?


Groeten
DJ
Homeseer 3 Pro on Windows 10 / Zwave

Edwin.
Post Reply

Return to “Homeseer Scripts Forum”