2

I need to create an email message with an attachment. The attachment contains a EDIFACT message.I need to define a custom Mime type for this attachment or something. I need to define a Mime Type application/x-EDIORDER. The .net provided mime types doesnt contain this mime type. How can I do this? I am using C# for sending the messages.

Thanks.

Shift
  • 642
  • 2
  • 9
  • 25
  • I would recommend to transfer EDIFACT message using AS2, and not e-mail. E-mail is the worst - most unreliable- transport protocol you can use to transfer electronic messages! – Babelabout Jul 14 '11 at 07:18

3 Answers3

3

You can specify any Mime ContentType by creating a new instance of Mime.ContentType for example:

Mail.Attachment attach = New Mail.Attachment(attachmentData, New Mime.ContentType("application/x-EDIORDER"));

For a few content types (such as HTML) you may find that you need to add it as a LinkedResource that is an AlternateView rather than attaching it as a regular attachment however I am unfamiliar with EDIORDER.

John
  • 29,788
  • 18
  • 89
  • 130
2

You can use System.Net.Mail Namespace to achieve this. The Attachment.Name property allow to set the MIME content type value in the content type associated with this attachment.

Paweł Smejda
  • 1,879
  • 1
  • 17
  • 25
0

Problem solved by adding the following code:

            ContentType ct = new ContentType("application/x-EDIORDER");

            Attachment data = new Attachment(EdiFile, ct);
Shift
  • 642
  • 2
  • 9
  • 25