We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com



I am new, and trying to find my way arround in Aspose.

We need to set the "Contenttype" of a mail tot "text/plain". We are not able to do so with our normale Dynamics NAV environment, so we try to use Aspose.

We cannot find the correct syntax on how to add the contenttype attribute to the ExchangeClient message.

Does anyone has a sample (c#) how it should be done?


Hi Benno,

Thanks for writing to Aspose.Email support team.

MailMessage is always created with default content type “text/plain” and it can be observed using following sample code. You may also check this content type by opening the resultant EML file in any editor. At the end of this example, code is given to send this mail using ExchangeClient.

MailMessage mail = new MailMessage("newcustomeronnet@gmail.com", "newcustomeronnet1@gmail.com", “Subject”, “Body”);
if (mail.BodyType == BodyContentType.PlainText)
mail.Save(“TestMsg.eml”, MessageFormat.Eml);

// Create instance of ExchangeClient class by giving credentials
ExchangeClient client = new ExchangeClient(“http://MachineName/exchange/username”,“username”, “password”, “domain”);

// send the message

Please feel free to write us back if you have any other query in this regard.

Hi Kashif,

Thank you for your answer, it is correct, but mij question was incomplete.

The problem is not the message bodytype, but the message header contenttype.

The result is:

Received: from V-EX-02.adfocom.nl ([::1]) by v-ex-02.adfocom.nl ([::1]) with
mapi id 14.02.0328.009; Thu, 31 Jan 2013 11:36:23 +0100
Content-Type: application/ms-tnef; name=“winmail.dat”
Content-Transfer-Encoding: binary
From: Greenline <greenline@adfocomsoftware.nl>
To: Klaas van Heeringen <kvheeringen@adfocomsoftware.nl>
CC: Benno van de Meent <bvdmeent@adfocomsoftware.nl>
Subject: Test met Aspose Exchange
Thread-Topic: Test met Aspose Exchange
Thread-Index: AQHN/57Qib2l0ukjxUqUZYzPRAJ9gQ==
Date: Thu, 31 Jan 2013 11:36:23 +0100
Message-ID: <94A2A84AFAEBE54D93A39B9C54C705C2243AA2A4@v-ex-02.adfocom.nl>
Accept-Language: nl-NL, en-US
Content-Language: en-US
X-MS-Exchange-Organization-SCL: -1
X-MS-TNEF-Correlator: <94A2A84AFAEBE54D93A39B9C54C705C2243AA2A4@v-ex-02.adfocom.nl>
MIME-Version: 1.0
X-MS-Exchange-Organization-AuthSource: v-ex-02.adfocom.nl
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 04
X-Originating-IP: []
X-MS-Exchange-Organization-AVStamp-Mailbox: SYMANTEC;473825536;0;info

The problems are with : Content-Type: application/ms-tnef

The receiver allows only “text/xml” or “application/edifact”.

So the real question is : how to set the header content type.



Hi Benno,

Sorry for the inconvenience you are facing.

I have searched the forum and other documents and came across this Link which states that

"The email header content-type is set by the server sending the email and contains information like To, From, Date, Time, etc. Some of which are displayed at the top of each email when viewing it in an email client."

You may please go through this link and share your findings with us.

If you still have some queries in this regard, then I need more clarification from you as I am somewhat unclear about if you are using Aspose's Exchange client to send email or retrieve emails from the exchange server? Also, can you please tell us if this happens only with this receiver or any other receiver server as well? I would also request you to provide us information about the exchange server you are using. If its possible for you to provide us a test account on your server, it will help us better analyze your requirements and assist accordingly.

During the investigation I also came across the following article which may be of your interest in some way:

How to Prevent Winmail.dat Attachments from Being Sent in Outlook