title: Outlook 2010 attachments go missing
body: <p>I have Windows Forms application which stores lots of documents and other attachments — i.e. a document management system. One of its features is a facility to email a bunch of attachments to a recipient. It does this by simply automating Outlook to compose a new email and we attach all the files to that message, and the user sends the email as normal through Outlook 2010.</p>
  
  <p>Something weird happens. Some of the attachments in the system are actually .msg files (i.e. other emails that have been stored in the document management system). If the email we create contains .msg attachments, when the email arrives at the destination, all attachments are stripped. The really odd thing is that this affects some recipients but not all. But crucially, it only happens when .msg files are in the email's attachments. Provided the email doesn't contain .msg files, it works fine every time.</p>
  
  <p>Any ideas?</p>
  
  <p>here is the code:</p>
  
  <pre><code>    Public Shared Sub CreateEmail(ByVal emailAddressTo As String, ByVal subject As String, ByVal bodyText As String, ByVal docs As DespatchDocumentFileList)
          ' create the email
          Dim olApp As Object = CreateObject("Outlook.Application")   ' New Outlook.Application
          Dim olMail As Object = olApp.CreateItem(0)                  ' Outlook.OlItemType.olMailItem
  
          ' init the email
          With olMail
              .BodyFormat = 2                                         ' Outlook.OlBodyFormat.olFormatHTML
              .Subject = subject
              .To = emailAddressTo
              .Body = bodyText
  
              For Each doc As DespatchDocumentFileInfo In docs
                  Dim DespatchFile As InternalClaimsLibrary.Despatch.DespatchDocumentFile = InternalClaimsLibrary.Despatch.DespatchDocumentFile.GetDespatchDocumentFile(doc.ID)
                  Dim FileName As String
  
                  FileName = InternalClaimsLibrary.FileUtils.FileHelper.CreateFileFromByteArray(DespatchFile.DespatchedImageData, IO.Path.GetFileName(DespatchFile.DespatchedFileName))
  
                  .Attachments.Add(FileName)
              Next
  
          End With
  
          olMail.Display()
  
      End Sub
  </code></pre>