0 votes
by (270 points)

Hello,

when we send mails with attachements over SMTP alle Attachemnets are declared Content-Type: application/octet-stream; this never was a problem until now we have a customer which email sw can't read those attachments, but if you declare it Content-Type: application/xml; for exsample everything would be fine.

Do we have a chance to specify this type?

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (73.5k points)
selected by
 
Best answer

Yes, just use any of Attachment constructors with mediaType parameter like this:

var attachment = new Rebex.Mail.Attachment("c:/data/some.xml", 
                                           "some.xml",
                                           "application/xml");

var mail = new MailMessage();
mail.Subject = "Mail with XML attachment";
mail.Attachments.Add(attachment);

Alternatively, you can use SetContent(..., mediaType) or SetContentFromFile(..., mediaType) methods of the Attachment object.

For mediaType parameter specify "application/xml".

...