Convert MIME tree to MailMessage

前端 未结 5 746
广开言路
广开言路 2021-01-14 15:52

I\'m writing a a C# program that processes and forwards email messages. I have a POP3 library and a MIME parser, and I need to copy the MIME tree into a System.Net.Ma

5条回答
  •  感动是毒
    2021-01-14 16:14

    Map any text part (text/plain, text/html etc.) that is contained within a multipart/alternative part to an AlternateView. Also map the first text part encountered to an AlternateView, regardless of its parent type, to cater for the case of the message only consisting of a single text part.

    Map the remaining parts to an Attachment or a LinkedResource, depending on the Content-Disposition header.

    Map those parts with a Content-Disposition of attachment, to an Attachment.

    Map those parts with a Content-Disposition of inline, or no Content-Disposition header, to a LinkedResource. This last step could be finessed by checking that the Content-ID matched a Content-ID referred to from a particular text part, but for practical purposes, it could be assumed that all LinkedResources created in this way belong to the first text/html AlternateView (or the last AlternateView created, if there is no AlternateView of type text/html).

提交回复
热议问题