Question

Whenever sending an email, I would like a copy of that email to be saved in the local folder, together with all attachments.

I don't think this is possible with a custom rule in Outlook but perhaps it could be done with a VBA script?

I use Outlook and MS Exchange.

Was it helpful?

Solution

Sure it can be done using the Application_ItemSend event procedure to call a custom procedure which will save your sent mails to a local folder.

This code goes in "ThisOutlookSession" module.

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

Sub SaveACopy(Item As Object)
    Const olMsg As Long = 3

    Dim m As MailItem
    Dim savePath As String

    If TypeName(Item) <> "MailItem" Then Exit Sub

    Set m = Item

    savePath = "c:\users\your_user_name\desktop\"  '## Modify as needed
    savePath = savePath & m.Subject & Format(Now(), "yyyy-mm-dd-hhNNss")
    savePath = savePath & ".msg"


    m.SaveAs savePath, olMsg


End Sub

You will need to ensure that the specified path is unique/etc., the above example is fairly crude. You also need strip out any illegal characters that can't be put in a file name (slash, pipes, etc.)...

As an alternative, I would suggest simply archiving your folder(s) periodically. You can configure Outlook to save a copy of sent mail to a "Sent" folder, and then you should be able to archive that folder; saving each item individually seems less-than-optimal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top