Auto Compression of Attachements sent with email



  • I am working on a small project idea. The objective of this is to compress any attachements present in a email (when the user clicks the ‘Send’ button). Before the email is sent the program(dll) has to compress the attachements and reattach them to the mail. This will significantly reduce the bandwidth being used by emails which are sent in n numbers.

    At ‘Siemens’ we use Powerarchiver as a standard zip tool.
    I would like your help in this area as how to integrate powerarchiver with Outlook.

    Awaiting your reply,



  • 'Here’s something to get you started - you can adjust it to suit your
    ’needs, multiple attachments, error checking etc… THIS IS BARE BONES
    ’In your Outlook VBA Code window paste this into “ThisOutLookSession”
    'Then create a new email message with an attachment and click send
    ’Your email will now have an attachment called “Little.zip”
    'Make sure C:\Temp exists, again this is bare bones!
    'Assumes pacomp.exe is on your system path
    ’Tested with Outlook 2003

    Private Declare Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    myZipSend
    End Sub

    Sub myZipSend()

    Dim myOlApp As Outlook.Application
    Dim myInspector As Outlook.Inspector
    Dim myItem As Outlook.MailItem
    Dim myAttachments As Outlook.Attachments
    Set myOlApp = CreateObject(“Outlook.Application”)
    Set myInspector = myOlApp.ActiveInspector
    If Not TypeName(myInspector) = “Nothing” Then
    If TypeName(myInspector.CurrentItem) = “MailItem” Then
    Set myItem = myInspector.CurrentItem
    Set myAttachments = myItem.Attachments
    myAttachments.Item(1).SaveAsFile “C:\Temp” & myAttachments.Item(1).FileName
    Shell “pacomp -a C:\Temp\Little.zip C:\Temp” & myAttachments.Item(1).FileName, vbHide
    myAttachments.Item(1).Delete
    Sleep 1000
    myAttachments.Add "C:\Temp\Little.zip"
    Else
    MsgBox "The item is of the wrong type."
    End If
    End If

    End Sub


  • conexware

    Thanks lookdaditsme for his help!

    PowerArchiver Outlook Plugin with many features will come out very soon (at the same time as v9.2) so you will have this integration transparently.



  • @ivan:

    Thanks lookdaditsme for his help!

    PowerArchiver Outlook Plugin with many features will come out very soon (at the same time as v9.2) so you will have this integration transparently.

    That will be for PowerArchiver - will it also be compatible with PACL ?


  • conexware

    No, but all the work will be transparent (without any windows). Plus, you will have enought options to set in Outlook Options dialog.


 

5
Online

9.8k
Users

6.0k
Topics

36.9k
Posts