How to save email attachment using OpenPop

前端 未结 7 808
渐次进展
渐次进展 2020-12-30 09:29

I have created a Web Email Application, How do I view and save attached files?

I am using OpenPop, a third Party d

7条回答
  •  生来不讨喜
    2020-12-30 10:19

    Just in case someone wants the code for VB.NET:

    For Each emailAttachment In client.GetMessage(count).FindAllAttachments
        AttachmentName = emailAttachment.FileName
        '----// Write the file to the folder in the following format:  followed by two underscores followed by the 
        Dim strmFile As New FileStream(Path.Combine("C:\Test\Attachments", EmailUniqueID & "__" & AttachmentName), FileMode.Create)
        Dim BinaryStream = New BinaryWriter(strmFile)
        BinaryStream.Write(emailAttachment.Body)
        BinaryStream.Close()
    Next
    

提交回复
热议问题