How to save Outlook floating emails and attachments

Hello @Edgar_Estuardo_Rodriguez ,

This won’t work with SMTP since it is a protocol for sending mail, as well as you won’t be able to retrieve mail using IMAP/POP if it is not located on an email server.

From what I understand you have saved email files, I’m going to assume they’re on .msg format, and they’re stored on a web server. Based on this assumption here is my approach:

  1. Download the email using HTTP/FTP —>refer to the administrator of the server to evaluate both possibilities.
  2. Extract the .msg file content with a script using Invoke Code, here’s a sample VB implementation I got from a popular external site
'This solution is presented as is, with no warranties. Troubleshoot as needed

Sub SaveOlAttachments()

Dim msg As Outlook.MailItem
Dim att As Outlook.Attachment
Dim strFilePath As String
Dim strAttPath As String

    'path for creating msgs
strFilePath = "C:\temp\"
    'path for saving attachments
strAttPath = "C:\temp1\"

strFile = Dir(strFilePath & "*.msg")
Do While Len(strFile) > 0
    Set msg = Application.CreateItemFromTemplate(strFilePath & strFile)
    If msg.Attachments.Count > 0 Then
         For Each att In msg.Attachments
             att.SaveAsFile strAttPath & att.FileName
         Next
    End If
    strFile = Dir
Loop

End Sub

References:

1 Like