Home > Software engineering >  Only using Multipart & MimePart in .Net MimeKit..............any help, Thanks
Only using Multipart & MimePart in .Net MimeKit..............any help, Thanks

Time:07-25

I just started using this but been stuck for a few days now, any help will greatly be appreciated.

1- Multipart objMP = new Multipart("related", {"Can I please get an example of what kind of array goes here?"});

2- Is there a way I can write to the mimepart from a string instead of from a stream.

Thanks in advance!

CodePudding user response:

Use this API instead: Multipart .ctor (String subtype)

Or, if you want to create a multipart/related part, you can also use MultipartRelated .ctor ()

To answer your questions, though...

1- Multipart objMP = new Multipart("related", {"Can I please get an example of what kind of array goes here?"});

The .ctor that you are trying to figure out how to use is meant to be used like this:

new Multipart ("related",
    new Header ("X-Custom-Header", "value"),
    new TextPart ("plain") {
        Text = "This is some text content."
    },
    new MimePart ("application", "octet-stream") {
        FileName = "attachment.pdf",
        ContentTransferEncoding = ContentEncoding.Base64,
        Content = new MimeContent (dataStream)
    });

2- Is there a way I can write to the mimepart from a string instead of from a stream.

Write to the MIME part? Not sure what you mean.

  • Related