Solved

VBscript (or batch file) for forwarding email with zipped file attachment.

Posted on 2010-09-23
11
984 Views
Last Modified: 2012-05-10
I have a Windows 2003 AD environment and I am looking for a script that will forward an email with zipped file attachments (or just the attachment) to a network folder. Any assistance is much appreciated!
0
Comment
Question by:Anthony K O365
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 2
  • 2
11 Comments
 
LVL 70

Expert Comment

by:Qlemo
ID: 33751513
What exactly do you mean with "forward to a network folder"? Copy the email as file, or mail it to a public folder in Exchange?
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33752018
Where does the script get the e-mail from or does the script generate the email with the attachments (say log files) and then send it to a PF or resource mailbox?
0
 

Author Comment

by:Anthony K O365
ID: 33758232
Is it possible to automate copying an email attachment (particularly a zipped file) to network share?
0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 70

Expert Comment

by:Qlemo
ID: 33758655
You want to have a means to automatically save attachments of emails on receive to a network folder? Yes, you can write some VBA code in Outlook to do that. But AFAIK there is no integrated way to do so with Exchange.
0
 
LVL 31

Accepted Solution

by:
MegaNuk3 earned 500 total points
ID: 33769309
0
 
LVL 31

Assisted Solution

by:MegaNuk3
MegaNuk3 earned 500 total points
ID: 33769357
The solution on this one seems to be exactly what you are looking for:
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_23916589.html

A rule fires the VBA code and then saves the attachment in a location of your choice...
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33769387
So you would just have to change the line:
If Right(LCase(olkFile.FileName, 3)) = "csv" Then
                                 TO
If Right(LCase(olkFile.FileName, 3)) = "zip" Then

and then modify the location to save to your network location
olkFile.SaveAsFile "Z:\SavedZipFiles\" & olkFile.FileName
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33769418
Reading further down in that question the line should be:
If Right(LCase(olkFile.FileName),3) = "zip" Then
0
 
LVL 31

Assisted Solution

by:MegaNuk3
MegaNuk3 earned 500 total points
ID: 33769439
So your code should be similar to the following:
Sub SaveCSVToDisk(Item As Outlook.MailItem)
    Dim olkFile As Outlook.Attachment
    For Each olkFile In Item.Attachments
        'Change the file name on the following line'
        If Right(LCase(olkFile.FileName), 3) = "zip" Then
            'Change the path the file will be saved to on the following line'
            olkFile.SaveAsFile "Z:\SavedZipFiles\" & olkFile.FileName
        End If
    Next
    Set olkFile = Nothing
End Sub

Open in new window

0
 

Author Closing Comment

by:Anthony K O365
ID: 33770702
This is what I was looking for. Thanks!
0
 
LVL 31

Expert Comment

by:MegaNuk3
ID: 33770981
No problem, thanks for the points
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question