473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

MailMessage.Headers and Content-Type

We are trying to set MailMessage Content-Type to be text/calendar
The following code has been used:
string subject = "Calendar test 3";
MailMessage emailMessage = new MailMessage();
emailMessage.To = <address>
emailMessage.Subject = "my subject";
emailMessage.Headers.Add("Content-Type","text/calendar;method=\"REQUEST\"");
emailMessage.Body=@"BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0....<the rest of iCalendar>
";
MailService.Send(emailMessage);

Even though the content-type was specified in Headers collection the
resulting message still contains "text/plain" content-type.

Please help.

Vlad
Apr 24 '06 #1
5 7394
You probably need to set the BodyFormat property on your MailMessage
object to get the content-type to what you want.

Example:

MailMessage mail = new MailMessage();
mail.To = <address>
mail.From = <address>
mail.Subject = emailSubject;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;

Hope that helps

http://www.harleyc.com
Vlad wrote:
We are trying to set MailMessage Content-Type to be text/calendar
The following code has been used:
string subject = "Calendar test 3";
MailMessage emailMessage = new MailMessage();
emailMessage.To = <address>
emailMessage.Subject = "my subject";
emailMessage.Headers.Add("Content-Type","text/calendar;method=\"REQUEST\"");
emailMessage.Body=@"BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0....<the rest of iCalendar>
";
MailService.Send(emailMessage);

Even though the content-type was specified in Headers collection the
resulting message still contains "text/plain" content-type.

Please help.

Vlad


Apr 24 '06 #2
I dont think it has anything to do with HTML/Plain text. Content-type is
email header--not HTTP header. I tried it anyways just to be safe and got
the same results - plain text.

Still need MSFT help with this!

<gu*********@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
You probably need to set the BodyFormat property on your MailMessage
object to get the content-type to what you want.

Example:

MailMessage mail = new MailMessage();
mail.To = <address>
mail.From = <address>
mail.Subject = emailSubject;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;

Hope that helps

http://www.harleyc.com
Vlad wrote:
We are trying to set MailMessage Content-Type to be text/calendar
The following code has been used:
string subject = "Calendar test 3";
MailMessage emailMessage = new MailMessage();
emailMessage.To = <address>
emailMessage.Subject = "my subject";
emailMessage.Headers.Add("Content-Type","text/calendar;method=\"REQUEST\"");
emailMessage.Body=@"BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0....<the rest of iCalendar>
";
MailService.Send(emailMessage);

Even though the content-type was specified in Headers collection the
resulting message still contains "text/plain" content-type.

Please help.

Vlad

Apr 25 '06 #3
I believe that if the email reader does not support the "text/calendar"
type, it is probably converting it to "text/plain". Why email reader are
you using? If you have a web access email account, you might try sending an
email to that account and view it in something like FireFox which supports
"text/calendar".
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Vlad" <Vl**@community.nospam> wrote in message
news:ex**************@TK2MSFTNGP04.phx.gbl...
I dont think it has anything to do with HTML/Plain text. Content-type is
email header--not HTTP header. I tried it anyways just to be safe and got
the same results - plain text.

Still need MSFT help with this!

<gu*********@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
You probably need to set the BodyFormat property on your MailMessage
object to get the content-type to what you want.

Example:

MailMessage mail = new MailMessage();
mail.To = <address>
mail.From = <address>
mail.Subject = emailSubject;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;

Hope that helps

http://www.harleyc.com
Vlad wrote:
We are trying to set MailMessage Content-Type to be text/calendar
The following code has been used:
string subject = "Calendar test 3";
MailMessage emailMessage = new MailMessage();
emailMessage.To = <address>
emailMessage.Subject = "my subject";
emailMessage.Headers.Add("Content-Type","text/calendar;method=\"REQUEST\"");
emailMessage.Body=@"BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0....<the rest of iCalendar>
";
MailService.Send(emailMessage);

Even though the content-type was specified in Headers collection the
resulting message still contains "text/plain" content-type.

Please help.

Vlad


Apr 26 '06 #4
Actually we use MS Outlook 2003 which does support it. We tried it with a
custom third-party component that sets the header fine. However when we did
it through .NET native component it didn't work.

--
Vlad
P.S. Please remove "REMOVETHIS" from my email address to reply...
"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
I believe that if the email reader does not support the "text/calendar"
type, it is probably converting it to "text/plain". Why email reader are
you using? If you have a web access email account, you might try sending
an email to that account and view it in something like FireFox which
supports "text/calendar".
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Vlad" <Vl**@community.nospam> wrote in message
news:ex**************@TK2MSFTNGP04.phx.gbl...
I dont think it has anything to do with HTML/Plain text. Content-type is
email header--not HTTP header. I tried it anyways just to be safe and got
the same results - plain text.

Still need MSFT help with this!

<gu*********@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
You probably need to set the BodyFormat property on your MailMessage
object to get the content-type to what you want.

Example:

MailMessage mail = new MailMessage();
mail.To = <address>
mail.From = <address>
mail.Subject = emailSubject;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;

Hope that helps

http://www.harleyc.com
Vlad wrote:
We are trying to set MailMessage Content-Type to be text/calendar
The following code has been used:
string subject = "Calendar test 3";
MailMessage emailMessage = new MailMessage();
emailMessage.To = <address>
emailMessage.Subject = "my subject";
emailMessage.Headers.Add("Content-Type","text/calendar;method=\"REQUEST\"");
emailMessage.Body=@"BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0....<the rest of iCalendar>
";
MailService.Send(emailMessage);

Even though the content-type was specified in Headers collection the
resulting message still contains "text/plain" content-type.

Please help.

Vlad



Apr 29 '06 #5
Actually we use MS Outlook 2003 which does support it. We tried it with a
custom third-party component that sets the header fine. However when we did
it through .NET native component it didn't work.

"Christopher Reed" <ca****@nospam.nospam> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
I believe that if the email reader does not support the "text/calendar"
type, it is probably converting it to "text/plain". Why email reader are
you using? If you have a web access email account, you might try sending
an email to that account and view it in something like FireFox which
supports "text/calendar".
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"Vlad" <Vl**@community.nospam> wrote in message
news:ex**************@TK2MSFTNGP04.phx.gbl...
I dont think it has anything to do with HTML/Plain text. Content-type is
email header--not HTTP header. I tried it anyways just to be safe and got
the same results - plain text.

Still need MSFT help with this!

<gu*********@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
You probably need to set the BodyFormat property on your MailMessage
object to get the content-type to what you want.

Example:

MailMessage mail = new MailMessage();
mail.To = <address>
mail.From = <address>
mail.Subject = emailSubject;
mail.BodyFormat = System.Web.Mail.MailFormat.Html;

Hope that helps

http://www.harleyc.com
Vlad wrote:
We are trying to set MailMessage Content-Type to be text/calendar
The following code has been used:
string subject = "Calendar test 3";
MailMessage emailMessage = new MailMessage();
emailMessage.To = <address>
emailMessage.Subject = "my subject";
emailMessage.Headers.Add("Content-Type","text/calendar;method=\"REQUEST\"");
emailMessage.Body=@"BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
VERSION:2.0....<the rest of iCalendar>
";
MailService.Send(emailMessage);

Even though the content-type was specified in Headers collection the
resulting message still contains "text/plain" content-type.

Please help.

Vlad



May 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Simran | last post by:
I need to set up an automated email system , which means users should not be able to respond back to the emails but at the same time, we need to track bounced emails. This is important as our...
1
by: asnowfall | last post by:
I am creating MailMessage out of already existing email message. My existing message has few custom properties. I wan to add them to System.Net.Mail.MailMessage How to add custom properties? ...
1
by: jwinn | last post by:
Is there any way to change the sensitivity level of a message by modifying the MailMessage.Headers collection? We're using an Exchange server here and I would rather not use VSTO at all since the...
8
by: travispennington | last post by:
To anyone that can assist me: I deeply appreciate your help!! I am developing an application with an outside vendor. The vendor has a very odd requirement. They need custom X-Headers added to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.