Hello!
There was a post about this before, but the solution provided there did not work for me. Here is the problem. (.net 1.1)
I create a MailMessage, set who its to, who its from, the SMTP server and give it a correct iCal Body (to the best of my knowledge, it works as a .ics file). I then set a Content-Type header to text/calendar. I send it to myself and I receive a plain text email. I examine the Content-Type in the message options (outlook 2003) and it is text/plain.
Its driving me crazy! I used a 3rd party tool and it just managed to create a 2nd Content-Type: text/calendar but it appears to be ignored. The body is still text!
Here is a snippet:
MailMessage oMail = new MailMessage();
oMail.To = "my address";
oMail.BodyFormat = MailFormat.Text;
oMail.BodyEncoding = System.Text.Encoding.ASCII;
oMail.From = "my address";
oMail.Priority = MailPriority.Normal;
oMail.Subject = "This is a test subject for this mail.";
oMail.Headers.Add("Content-Type", @"text/calendar; method=REQUEST; charset=US-ASCII");
oMail.Body = @"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:<my hotmail address>
ORGANIZER:MAILTO:<my address>
DTSTART:20070604T120000Z
DTEND:20070604T130000Z
LOCATION:Another test place
TRANSP:OPAQUE
SEQUENCE:0
UID:040000008200E00074C5B71WIBBLYWOBBLYWAAAAAGAAAWAAAGAAAWOOOOO
DTSTAMP:20070604T091607Z
DESCRIPTION:When: 04 June 2007 13:00-14:00 (GMT) Greenwich Mean Time : Dublin\, Edinburgh\, Lisbon\, London.\nWhere: Another test place\n\n*~*~*~*~*~*~*~*~*~*\n\nThis is a test body that was 2 tabs\n\nThat was 2 line breaks\n
SUMMARY:Another test meeting
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASSUBLIC
END:VEVENT
END:VCALENDAR
.";
SmtpMail.SmtpServer = "217.29.193.42";
SmtpMail.Send(oMail);
There is some other code i have in between which is irrelovant to the mail sending (displaying headers of mail before send on a web page, a commented out attachment etc).
Any help is desperately needed and greatly appreciated! Thanks in advance!
There was a post about this before, but the solution provided there did not work for me. Here is the problem. (.net 1.1)
I create a MailMessage, set who its to, who its from, the SMTP server and give it a correct iCal Body (to the best of my knowledge, it works as a .ics file). I then set a Content-Type header to text/calendar. I send it to myself and I receive a plain text email. I examine the Content-Type in the message options (outlook 2003) and it is text/plain.
Its driving me crazy! I used a 3rd party tool and it just managed to create a 2nd Content-Type: text/calendar but it appears to be ignored. The body is still text!
Here is a snippet:
MailMessage oMail = new MailMessage();
oMail.To = "my address";
oMail.BodyFormat = MailFormat.Text;
oMail.BodyEncoding = System.Text.Encoding.ASCII;
oMail.From = "my address";
oMail.Priority = MailPriority.Normal;
oMail.Subject = "This is a test subject for this mail.";
oMail.Headers.Add("Content-Type", @"text/calendar; method=REQUEST; charset=US-ASCII");
oMail.Body = @"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:<my hotmail address>
ORGANIZER:MAILTO:<my address>
DTSTART:20070604T120000Z
DTEND:20070604T130000Z
LOCATION:Another test place
TRANSP:OPAQUE
SEQUENCE:0
UID:040000008200E00074C5B71WIBBLYWOBBLYWAAAAAGAAAWAAAGAAAWOOOOO
DTSTAMP:20070604T091607Z
DESCRIPTION:When: 04 June 2007 13:00-14:00 (GMT) Greenwich Mean Time : Dublin\, Edinburgh\, Lisbon\, London.\nWhere: Another test place\n\n*~*~*~*~*~*~*~*~*~*\n\nThis is a test body that was 2 tabs\n\nThat was 2 line breaks\n
SUMMARY:Another test meeting
PRIORITY:5
X-MICROSOFT-CDO-IMPORTANCE:1
CLASSUBLIC
END:VEVENT
END:VCALENDAR
.";
SmtpMail.SmtpServer = "217.29.193.42";
SmtpMail.Send(oMail);
There is some other code i have in between which is irrelovant to the mail sending (displaying headers of mail before send on a web page, a commented out attachment etc).
Any help is desperately needed and greatly appreciated! Thanks in advance!