• Script to save received messages (Outlook 2003 SP

    Home » Forums » AskWoody support » Productivity software by function » MS Outlook and email programs » Script to save received messages (Outlook 2003 SP

    Author
    Topic
    #416995

    Hi,
    I receive some newsletters that I want to save as text or html in order to keep then outside of Outlook. I’m looking for some kind of plug-in or script that allows me to establish a rule that automatically save the messages to their folder (I mean Windows’ folders, not Outlook’s), with their subject as filename. If someone knows something about it, or want to help me with the script (my programming skills are close to null), I’ll appreciate that.
    Best regards and thank you for your attention

    Viewing 2 reply threads
    Author
    Replies
    • #934316

      Have a look at what is available from Ornic

    • #934341

      This is some untested sample code. You will need to edit it as necessary for the newsletter sender names and path to save the file, then place it in the ThisOutlookSession module of Outlook’s Visual Basic Editor (VBE), save the code, and close and restart Outlook. See posts post 398131 for more advice on using the VBE You can test and debug it by dragging old newsletters that you want saved into your default message Inbox. It will need some tuning to get an exact match to the newsletters you want to target. Post back with any problems.

      Option Explicit

      Public WithEvents itmsNewMessages As Outlook.Items

      Private Sub Application_Startup()
      Set itmsNewMessages = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
      End Sub

      Private Sub Application_Quit()
      Set itmsNewMessages = Nothing
      End Sub

      Private Sub itmsNewMessages_ItemAdd(ByVal Item As Object)
      ‘ enter the sender names of the newsletters in the quotes section here
      Const strNewsLetterNames As String = “server@letters.dailyblab.com, bob@listserver.notforprofit.org
      ‘ enter the folder path for saving the messages here
      Const strPath As String = “C:Documents and SettingsusernameMy DocumentsNewsletters”
      Dim strSName As String, strMsgName As String

      If Item.Class = olMail Then
      With Item
      strSName = .SenderName
      If InStr(1, strNewsLetterNames, strSName, vbTextCompare) > 0 Then
      strMsgName = strPath & strSName & “_” & .Subject & “_” & _
      Replace(CStr(Int(.ReceivedTime)), “/”, “-“)
      .SaveAs strMsgName, olHTML
      ‘ .Delete ‘ remove the first quote if you want the newsletter deleted
      End If
      End With
      End If
      End Sub

    • #934353

      Thank you both for such quick answers. I’ll give a try and then I’ll give some feedback.
      Best regards

    Viewing 2 reply threads
    Reply To: Script to save received messages (Outlook 2003 SP

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: