nimi
nimi

Reputation: 5507

Is Lotus notes email client unable to render <br > tag?

I have a weird problem with Lotus Notes 8.5. In my project I am sending meeting invitation to the user. for that, I generate .ics file. Here is how i generate .ics file

var body = "Dear Raj, \n\n How are you? line break is not working \n\n how?";
using (TextWriter writer = File.CreateText("../test.ics"))
{
    writer.WriteLine("BEGIN:VCALENDAR");
    writer.WriteLine("PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN");
    writer.WriteLine("VERSION:2.0");
    writer.WriteLine("METHOD:REQUEST");
    writer.WriteLine("BEGIN:VEVENT");
    writer.WriteLine("ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:[email protected]");
    writer.WriteLine("ORGANIZER;CN="Organizer":MAILTO:[email protected]");
    writer.WriteLine("(DTSTART:20141231T010000Z");
    writer.WriteLine("DTEND:20141231T010000Z");
    writer.WriteLine("TRANSP:OPAQUE");
    writer.WriteLine("SEQUENCE:0");
    writer.WriteLine("UID:Company-interview-123");
    writer.WriteLine("DTSTAMP:20141223T232322Z");
    writer.WriteLine("SUMMARY:Interview Scheduled for Job");
    writer.WriteLine("DESCRIPTION:{0}", body.Replace("\n","<br />"));
    //Adding below property actually fixed the issue.
    writer.WriteLine("X-ALT-DESC;FMTTYPE=text/html:{0}", body.Replace("\n","<br />"));
    writer.WriteLine("LOCATION:Test Location");
    writer.WriteLine("PRIORITY:5");
    writer.WriteLine("X-MICROSOFT-CDO-IMPORTANCE:1");
    writer.WriteLine("CLASS:PUBLIC");
    writer.WriteLine("BEGIN:VALARM");
    writer.WriteLine("TRIGGER:-PT15M");
    writer.WriteLine("ACTION:DISPLAY");
    writer.WriteLine("DESCRIPTION:Reminder");
    writer.WriteLine("END:VALARM");
    writer.WriteLine("END:VEVENT");
    writer.WriteLine("END:VCALENDAR");

}

But Lotus email client is displaying the content as such. its showing

Dear Raj, <br><br> How are you? line break is not working <br><br> how?

On all other email clients, my content is displaying as

Dear Raj, 

How are you? line break is not working 

how?

Am i missing something here?

Updated my .ics generation code to add X-ALT-DESC;FMTTYPE=text/html: to fix the issue

Upvotes: 0

Views: 762

Answers (2)

Arnaud Quillaud
Arnaud Quillaud

Reputation: 4645

The DESCRIPTION property is not meant to contain any rich text/html content but only plain text.

Lotus Notes may use some other property (X- property) to convey rich text description. Or it may use an ALTREP parameter on the DESCRIPTION, that point to another MIME bodypart in the invitation. See https://www.rfc-editor.org/rfc/rfc5545#section-3.2.1

So what you probably want to do is to send an invitation containing rich text from Lotus Notes to some external account, and then see what the MIME message that you receive looks like.

Upvotes: 0

Tode
Tode

Reputation: 12080

I just checked with a vcard that contains your Text in Lotus Notes 8.5 and IBM Notes 9, and it worked exactly as expected. BUT: It worked with your "original" Text without the replace. In the RFC2445 it states, that Line- Breaks have to be encoded as \n:

An intentional formatted text line break MUST only be included in a "TEXT" property value by representing the line break with the character sequence of BACKSLASH (US-ASCII decimal 92), followed by a LATIN SMALL LETTER N (US-ASCII decimal 110) or a LATIN CAPITAL LETTER N (US-ASCII decimal 78), that is "\n" or "\N".

That means: use

writer.WriteLine("DESCRIPTION:{0}", body);

instead of

writer.WriteLine("DESCRIPTION:{0}", body.Replace("\n","<br>"));

And your problem should be solved

Upvotes: 1

Related Questions