James Murrell
asked on
fetch email attachments
is it possible to extract just the attachment out of a email
i have created imap account email user test@ wwwwww.net
which will get two emails daily the emails will only have a subject dbstats1 or dbstat2 and a zip attachment
would like in vbs or python
i have created imap account email user test@ wwwwww.net
which will get two emails daily the emails will only have a subject dbstats1 or dbstat2 and a zip attachment
would like in vbs or python
I know you would prefer vbs or python but here is a library you can use from a .Net application: http://www.lesnikowski.com/mail/Index.aspx
ASKER
no to .net now development tools / not enough learning time
Hi, cs97jjm3.
What email client do you have on your computer? If it's Outlook, then I can show you how to script this using VBScript.
What email client do you have on your computer? If it's Outlook, then I can show you how to script this using VBScript.
ASKER
thunderbird... but could setup outlook, but ideally not.....
Sorry, don't know anything about Thunderbird other than what it is. If you decide to use Outlook, then I'll be glad to help.
ASKER
Outlook express ok?
Outlook Express isn't programmable. Only the full version of Outlook.
ASKER
ok can use outlook if need be? 2003 ok
Outlook 2003 is fine. Here's the code. Follow these instructions to use this.
1. Open Notepad
2. Copy the code in the snippet
3. Paste the code into Notepad
4. Edit the code as needed. I placed comments where things can or should change.
5. Save the file with a .vbs extension
6. Run the code by double-clicking on the file
The code uses Outlook to check all messages in the inbox. If a message has a subject of "dbstats1" or "dbstats2", then the code saves all the message attachments to the folder of your choice.
1. Open Notepad
2. Copy the code in the snippet
3. Paste the code into Notepad
4. Edit the code as needed. I placed comments where things can or should change.
5. Save the file with a .vbs extension
6. Run the code by double-clicking on the file
The code uses Outlook to check all messages in the inbox. If a message has a subject of "dbstats1" or "dbstats2", then the code saves all the message attachments to the folder of your choice.
Dim olkApp, olkSes, olkFld, olkMsg, olkAtt
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.GetNameSpace("MAPI")
'Change the profile name on the next line'
olkSes.Logon "Outlook"
Set olkFld = olkSes.GetDefaultFolder(6)
For Each olkMsg in olkFld.Items
Select Case LCase(olkMsg.Subject)
Case "dbstats1", "dbstats2"
For Each olkAtt in olkMsg.Attachments
'Change the path on the next line as desired'
olkAtt.SaveAsFile "C:\Some Folder\" & olkAtt.Filename
Next
End Select
Next
Set olkAtt = Nothing
Set olkMsg = Nothing
Set olkFld = Nothing
olkSes.Logoff
Set olkSes = Nothing
Set olkApp = Nothing
ASKER
silly question, does outlook have to be open? if so can code do that... and do a send and recieve
ASKER
ok ignore last comment
Set oShell = CreateObject("WScript.Shel l")
oShell.Run "outlook"
did the trick -
but can code mark to delete? or delete
ps: cheers for this
Set oShell = CreateObject("WScript.Shel
oShell.Run "outlook"
did the trick -
but can code mark to delete? or delete
ps: cheers for this
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks you for you help, you explain the code very well a star a ee i would say
Thank you! Glad I could help out.
Please let me know how to filter only the attached of daily data like todays data not all of the attached email. Thanks for your co-operation and understanding.