The following function will help you send html content as a mail
****************************************************************************
Function sendHTMLContentAsMail(recipients As Variant,ccTo As Variant,bccTo As Variant, _
Subject As String,bodyHtmlContent As String)
 'Declare Variables 
 Dim s As New NotesSession
 Dim db As NotesDatabase
 Dim body As NotesMIMEEntity
 Dim stream As NotesStream
 Dim host As String
 Dim message As  NotesDocument 
 
 On Error Goto errHandler
 
 Set db = s.CurrentDatabase
 Set message=db.CreateDocument
  'Capture the server name and filepath for use in URLs
 Dim ServerName As New NotesName( db.Server )
 host = "http://" + ServerName.Common & ".com"
 
 s.ConvertMIME = False ' Do not convert MIME to rich text
 Set stream = s.CreateStream
 Set body = message.CreateMIMEEntity
 message.Subject =Subject
 message.SendTo =recipients
 message.CopyTo =ccTo
 message.BlindCopyTo =bccTo
 message.RecNoOutOfOffice = "1"   
 Call stream.WriteText (bodyHtmlContent)
  ' Ensure the MIME content will be recognized as HTML   (Must be after the stream is written)
 Call body.SetContentFromText (stream, "text/html;charset=iso-8859-1", ENC_NONE) 
 Call message.Send (False)  
 
 s.ConvertMIME = True ' Restore conversion
 Exit Function
errHandler:
 Msgbox Error,,Cstr(Erl)
 Exit Function
End Function
********************************************************************************
Hope this helps :)
Hi Karthikeyan Alagiri Brother...
ReplyDeletePls can you suggest me to do the same in Notes 8.5.1, Actually I have a javascript code for this setContentFromText, it is working on 8.5.2. But it is not working on 8.5.1...
It is throwing Error Like
"Error while executing JavaScript action expression
Script interpreter error, line=47, col=10: Method NotesMIMEEntity.setContentFromText(lotus.domino.local.Stream, string, undefined) not found, or illegal parameters"