Search code examples
emaillotus-noteslotusscriptrichtext

Why is a memo created and sent from a LotusScript agent converting rich text to plain and removing document links?


We have a Document Library set up to accept user administration requests from our managed school districts. I recently made some updates to the form used to enter requests and some minor changes to the agent used to notify our administrators of the new request. Since these changes, the notification emails, which were once being received in rich text with an embedded document link, are now coming in as plain text. I have reverted both the form and the agent to previous versions and email message remains plain text. The agent's code follows.

Option Public
Use "Variables"
Dim db As NotesDatabase
Sub Initialize
    On Error Goto gotError
    Set s = New NotesSession
    Dim doc As NotesDocument
    Dim kbaseDb As NotesDatabase
    Dim kdoc As NotesDocument
    Set db = s.CurrentDatabase
    Set doc = s.DocumentContext 

    Dim fromName As NotesName
    Dim commName As String
    Set fromName = s.CreateName(doc.from(0))
    commName = fromName.Common

    Dim memo As New NotesDocument(db)
    Dim body As NotesRichTextItem

    memo.Form = "Memo"
    memo.SendTo = techEmail
    memo.Subject = doc.categories(0) + " admin request from " + districtName

    If doc.priorityflag(0) = "Priority"  Then
        memo.Subject = doc.Categories(0) + " PRIORITY admin request from " + districtName
        memo.DeliveryPriority = "H"
    End If

    Set body = memo.Createrichtextitem("Body")
    Call body.AppendText("Please process this " + doc.action(0) + " request from " + commName + ".")
    Call body.AddNewLine(2)
    Call body.AppendText("Comment: " + doc.comment(0))
    Call body.AddNewLine(1)
    Call body.AddNewLine(1)
    Call body.AddNewLine(1)
    Call body.AppendText("Link to request  ")
    Call body.AppendDocLink( doc, "Link to request  ")

    Call memo.send(False)

    Call doc.ReplaceItemValue("OwnerNotified", doc.Owner)
    Call doc.Save(True, False)  


    Exit Sub
gotError:
    Print "<b><FONT color=red>System Error (" + Str(Err) + "): " + Error
    Exit Sub
End Sub

Solution

  • The fix was to change the "Message Content" setting for outbound MIME conversion. This is set to "Convert from Notes to plain text" by default and needed to be changed to "Convert from Notes to HTML".

    Details are on this page in the InfoCenter: http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=%2Fcom.ibm.help.domino.admin.doc%2FDOC%2FH_SPECIFYING_MIME_CONVERSION_OPTIONS_OVER.html