Solved

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

Posted on 2010-09-23
11
983 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:K Anthony 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:K Anthony O365
ID: 33758232
Is it possible to automate copying an email attachment (particularly a zipped file) to network share?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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:K Anthony 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

Office 365 Training for Admins - 7 Day Trial

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.

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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…

734 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