Plain text is not always plain text

Today I’ve been faced with a very interesting behaviour of sending plain text mails.

We are using a 3rd party provider for sending mobile short messages (SMS) to other mobile phones. For that I’ve implemented an internal Domino domain, i. e. “@SMS”. The target of this domain is a mail-in database, which is monitored by a java add-in task. On special events this task triggers an LotusScript agent which reads the new mails in the mail-in database, converts the content into a special syntax, puts this syntax into the mail body of a new mail and sends it to our 3rd party provider.

And yesterday evening these mails came back! I didn’t know why, but all mails sent by the task had a wrong syntax. The strange thing was, that I didn’t change the task.

After some research today with several freemail provider accounts and after calling the 3rd party provider (“No, we didn’t change anything here”) I took a look at those task mails. The body has to be in plain text – HTML or other richt text isn’t allowed, because that couldn’t be read by the 3rd party providers system.

The agent creates the body field with a simple

docThis.ReplaceItemValue(“Body”,”ThisIsMyText”).

I stopped the router on our SMTP gateway, took a look at the field – and yes, just a text field, no rich text. So I tried to send mails with NotesSession.convertMime=False. And – you guess right, nothing changed.

So I tried

NotesDocument.convertMime(1)

which means: convert any rich text to plain text. I just tried – and it was successful. I still ask myself: “Why needs a text field to be converted from RTF to plain text?”

So – be aware of those paramenters when you have to send plain text. As it’s not always that what it looks like to be…