meciab
asked on
Send Formated html in lotus?
I'd like to send a html code in lotus
I found the way to send my text but it's not interpreted as html, for example, if you execute
"mailto:?subject=My Test&body=<html><head><tit le>MyTitle </title> <meta http-equiv=" & Chr(34) & "Content-Type" & Chr(34) & " content=" & Chr(34) & "text/html; charset=iso-8859-1" & Chr(34) & "> <body bgcolor=" & Chr(34) & "#FFFFFF" & Chr(34) & "> <div align=" & Chr(34) & "center" & Chr(34) & "><b>size=" & Chr(34) & "7" & Chr(34) & ">HelloWorld</font></b></d iv></body> </html>"
the code is in the body but as text not as htm
and it's seems that there's a limition in the number of characters (around 250)
Does anyome know a way to fix this problem? Many many thx
I found the way to send my text but it's not interpreted as html, for example, if you execute
"mailto:?subject=My Test&body=<html><head><tit
the code is in the body but as text not as htm
and it's seems that there's a limition in the number of characters (around 250)
Does anyome know a way to fix this problem? Many many thx
This method won't get your there ! Not in Lotus Notes, but not in any other messaging system .... The 255 character limit is only 1 of the reasons (but a very important reason :-) )
You'll have to use a java or lotusscript agent to do it, one of the methods you can use is this (R6 only!)
http://searchdomino.techtarget.com/tip/1,289483,sid4_gci958913,00.html
Another method is to use the web task on the Domino server, to render the HTML mail and then use the document in the web.nsf database on the server to create a new memo :
http://www.eview.com/eview/viewr5.nsf/e640f630a3361f84852568f600070fd3/1a2e448f2316e11d85256d4b0069e875?OpenDocument&Highlight=2,html,mail
cheers,
Tom
You'll have to use a java or lotusscript agent to do it, one of the methods you can use is this (R6 only!)
http://searchdomino.techtarget.com/tip/1,289483,sid4_gci958913,00.html
Another method is to use the web task on the Domino server, to render the HTML mail and then use the document in the web.nsf database on the server to create a new memo :
http://www.eview.com/eview/viewr5.nsf/e640f630a3361f84852568f600070fd3/1a2e448f2316e11d85256d4b0069e875?OpenDocument&Highlight=2,html,mail
cheers,
Tom
"mailto:?subject='My Test'&body='<html><head><t itle>MyTit le</title> <meta http-equiv=\"Content-Type\ " content=\"text/html; charset=iso-8859-1\"> <body bgcolor=\"FFFFFF\"> <div align=\"center\"><b>size=\ "7\">Hello World</fon t></b></di v></body>< /html>'"
ASKER
I use lotus 6.5
Sorry I let the " & chr(34) & " instead of " cause I use vb to send this
Sorry I let the " & chr(34) & " instead of " cause I use vb to send this
Sending HTML mails couldn't get any simpler. Check out this outstanding piece of code.
http://openntf.org/Projects/codebin/codebin.nsf/CodeSearch/4322A3203262705188256D5E0034329D
Download this library and get going instantly!!!
http://openntf.org/Projects/codebin/codebin.nsf/CodeSearch/4322A3203262705188256D5E0034329D/$file/SimpleMIME.lss
~ Ranjeet Rain
http://openntf.org/Projects/codebin/codebin.nsf/CodeSearch/4322A3203262705188256D5E0034329D
Download this library and get going instantly!!!
http://openntf.org/Projects/codebin/codebin.nsf/CodeSearch/4322A3203262705188256D5E0034329D/$file/SimpleMIME.lss
~ Ranjeet Rain
ASKER
How to use it?
I want to use it via visual basic, do you know a way?
I want to use it via visual basic, do you know a way?
With a bit of R&D you can EASILY do that. Do you expect readymade code?
In your VB project, create a function which uses Domino COM interface , such as :-
Function sendHTMLemail()
Dim session As Object
Dim db As Object
Dim doc As Object
Dim rtitem As Object
Dim msg As String
Dim email As String
Set session = CreateObject("Notes.Notess ession")
Set db = session.GETDATABASE("", "")
Call db.OPENMAIL
Set doc = db.CREATEDOCUMENT
doc.SendTo = "testing@testing.com"
doc.Subject = "Testing
doc.Form = "Memo"
Set rtitem = doc.CREATERICHTEXTITEM("Bo dy")
Call rtitem.APPENDTEXT("<HTML>" )
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("<HEAD>" )
Call rtitem.ADDNEWLINE(1)
Call rtitem.APPENDTEXT("<TITLE> HTML Page</TITLE>")
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("</HEAD> ")
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("<BODY>" )
Call rtitem.ADDNEWLINE(1)
Call rtitem.APPENDTEXT("Hello From HTML EMAIL")
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("</BODY> ")
Call doc.SEND(False)
Set session = Nothing
End Function
Function sendHTMLemail()
Dim session As Object
Dim db As Object
Dim doc As Object
Dim rtitem As Object
Dim msg As String
Dim email As String
Set session = CreateObject("Notes.Notess
Set db = session.GETDATABASE("", "")
Call db.OPENMAIL
Set doc = db.CREATEDOCUMENT
doc.SendTo = "testing@testing.com"
doc.Subject = "Testing
doc.Form = "Memo"
Set rtitem = doc.CREATERICHTEXTITEM("Bo
Call rtitem.APPENDTEXT("<HTML>"
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("<HEAD>"
Call rtitem.ADDNEWLINE(1)
Call rtitem.APPENDTEXT("<TITLE>
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("</HEAD>
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("<BODY>"
Call rtitem.ADDNEWLINE(1)
Call rtitem.APPENDTEXT("Hello From HTML EMAIL")
Call rtitem.ADDNEWLINE(1)
Call rtitem.ADDNEWLINE("</BODY>
Call doc.SEND(False)
Set session = Nothing
End Function
ASKER
Your code send the mail directly, and th html code appear in text
I want to display an html in lotus "ready to send" (who allow to enter contact with lotus and do some modification if necessary)
I want to display an html in lotus "ready to send" (who allow to enter contact with lotus and do some modification if necessary)
You can combine the code in the examples with the COM interface coding , the biggest difference will be the session object, that has to be initialized as a Notes.notessession....
Tom
Tom
ASKER
I found another way to display make it display in Lotus
but i can't find the way to display it as html, it's still displayed à text
(run send_click)
Option Explicit
'---------- API -----------
'pour faire passer au premier plan
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
'pour ouvrir la fenetre
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
'pour verifier si la Lotus est ouvert
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Dim sSrvr As String 'the mail server for the current user
Dim MailDbName As String 'THe current users notes mail database name
Dim UserName As String 'The current users notes name
Dim retval As Variant 'Holds return value for functions handle
'---------------- fonction ouverture de session Notes -----------
Function CreateNotesSession() As Boolean
Const notesclass$ = "NOTES"
Const SW_SHOWMAXIMIZED = 3 'plein ecran
Const SW_SHOWMMINIZED = 2 'reduire
Const SW_SHOWWINDOW = 1 'fenetre
Const SW_SHOW = 5
Dim Lotus_Session As Object
Dim rc&
Dim lotusWindow&
lotusWindow = FindWindow(notesclass, vbNullString)
Set Lotus_Session = CreateObject("Notes.NotesS ession")
sSrvr = Lotus_Session.GetEnvironme ntString(" MailServer ", True)
MailDbName = Lotus_Session.GetEnvironme ntString(" MailFile", True)
UserName = Lotus_Session.UserName
DoEvents
'Ouverture de Lotus Notes
retval = Shell("C:\Program Files\lotus\notes\notes.ex e =h:\notes\notes.ini", vbMaximizedFocus)
'verifier que Lotus est bien ouvert (recupere le handle)
lotusWindow = FindWindow(notesclass, vbNullString)
If lotusWindow <> 0 Then
rc = ShowWindow(lotusWindow, SW_SHOW)
rc = SetForegroundWindow(lotusW indow)
CreateNotesSession = True
Else
CreateNotesSession = False
End If
End Function
Sub CreateMailandAttachFileAdr (Optional IsSubject As String = "", Optional SendToAdr As String, Optional CCToAdr As String, Optional BCCToAdr As String = "", Optional Attach1 As String = "", Optional Attach2 As String = "", Optional body As String = "")
Const EMBED_ATTACHMENT As Integer = 1454
Const EMBED_OBJECT As Integer = 1453
Const EMBED_OBJECTLINK As Integer = 1452
Dim s As Object ' use back end classes to obtain mail database name
Dim db As Object '
Dim doc As Object ' front end document
Dim beDoc As Object ' back end document
Dim workspace As Object ' use front end classes to display to user
Dim bodypart As Object '
Dim bodyAtt As Object '
Dim lbsession As Boolean
lbsession = CreateNotesSession
If lbsession Then
'cree la session Lotus Notes
Set s = CreateObject("Notes.Notess ession")
'se connecte a sa database
Set db = s.GetDatabase(sSrvr, MailDbName)
If db.IsOpen = True Then
'database deja ouvert
Else
Call db.Openmail
End If
'cree un document memo
Set beDoc = db.CreateDocument
beDoc.Form = "Memo"
'construction du mail
Set bodypart = beDoc.CreateRichTextItem(" Body")
'beDoc.From = "Moi" 'inutile
beDoc.SendTo = SendToAdr
beDoc.CopyTo = CCToAdr
beDoc.BlindCopyTo = BCCToAdr
beDoc.Subject = IsSubject
'------------------------- ---------- ------
'Remarque si destinataire multiple il suffie de mettre un tableau d'e-mail dans SendTo (CopyTo,BlindCopyTo)
'exemple :
'Dim recip(25) as variant
'recip(0) = "emailaddress1"
'recip(1) = "emailaddress2" e.t.c
'beDoc.sendto = recip
'------------------------- ---------- -----
' documents joint 1
If Len(Attach1) > 0 Then
If Len(Dir(Attach1)) > 0 Then
Set bodyAtt = bodypart.EmbedObject(EMBED _ATTACHMEN T, "", Attach1, Dir(Attach1))
End If
End If
' documents joint 2
If Len(Attach2) > 0 Then
If Len(Dir(Attach2)) > 0 Then
Call bodyAtt.EmbedObject(EMBED_ ATTACHMENT , "", Attach2, Dir(Attach2))
End If
End If
'Affichage du mail dans Lotus Notes
Set workspace = CreateObject("Notes.NotesU IWorkspace ")
Call workspace.EditDocument(Tru e, beDoc).FieldSetText("Body" , body)
Set s = Nothing
Else
MsgBox "Lotus is close"
End If
End Sub
Private Sub Send_Click()
Dim html As String
html = "This <i>is</i> an <b>example</b><p>"
html = html + "<font color=purple>Wanna know where I work?</font><p>Click <a href=" & Chr(34) & "http://www.peopleware.be" & Chr(34) & ">here</a>"
CreateMailandAttachFileAdr "Msujet", "Mto", "Mcc", "Mbcc", "c:\SNOVA.PLT", "c:\SNOVA2.PLT", html
End Sub
but i can't find the way to display it as html, it's still displayed à text
(run send_click)
Option Explicit
'---------- API -----------
'pour faire passer au premier plan
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
'pour ouvrir la fenetre
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
'pour verifier si la Lotus est ouvert
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Dim sSrvr As String 'the mail server for the current user
Dim MailDbName As String 'THe current users notes mail database name
Dim UserName As String 'The current users notes name
Dim retval As Variant 'Holds return value for functions handle
'---------------- fonction ouverture de session Notes -----------
Function CreateNotesSession() As Boolean
Const notesclass$ = "NOTES"
Const SW_SHOWMAXIMIZED = 3 'plein ecran
Const SW_SHOWMMINIZED = 2 'reduire
Const SW_SHOWWINDOW = 1 'fenetre
Const SW_SHOW = 5
Dim Lotus_Session As Object
Dim rc&
Dim lotusWindow&
lotusWindow = FindWindow(notesclass, vbNullString)
Set Lotus_Session = CreateObject("Notes.NotesS
sSrvr = Lotus_Session.GetEnvironme
MailDbName = Lotus_Session.GetEnvironme
UserName = Lotus_Session.UserName
DoEvents
'Ouverture de Lotus Notes
retval = Shell("C:\Program Files\lotus\notes\notes.ex
'verifier que Lotus est bien ouvert (recupere le handle)
lotusWindow = FindWindow(notesclass, vbNullString)
If lotusWindow <> 0 Then
rc = ShowWindow(lotusWindow, SW_SHOW)
rc = SetForegroundWindow(lotusW
CreateNotesSession = True
Else
CreateNotesSession = False
End If
End Function
Sub CreateMailandAttachFileAdr
Const EMBED_ATTACHMENT As Integer = 1454
Const EMBED_OBJECT As Integer = 1453
Const EMBED_OBJECTLINK As Integer = 1452
Dim s As Object ' use back end classes to obtain mail database name
Dim db As Object '
Dim doc As Object ' front end document
Dim beDoc As Object ' back end document
Dim workspace As Object ' use front end classes to display to user
Dim bodypart As Object '
Dim bodyAtt As Object '
Dim lbsession As Boolean
lbsession = CreateNotesSession
If lbsession Then
'cree la session Lotus Notes
Set s = CreateObject("Notes.Notess
'se connecte a sa database
Set db = s.GetDatabase(sSrvr, MailDbName)
If db.IsOpen = True Then
'database deja ouvert
Else
Call db.Openmail
End If
'cree un document memo
Set beDoc = db.CreateDocument
beDoc.Form = "Memo"
'construction du mail
Set bodypart = beDoc.CreateRichTextItem("
'beDoc.From = "Moi" 'inutile
beDoc.SendTo = SendToAdr
beDoc.CopyTo = CCToAdr
beDoc.BlindCopyTo = BCCToAdr
beDoc.Subject = IsSubject
'-------------------------
'Remarque si destinataire multiple il suffie de mettre un tableau d'e-mail dans SendTo (CopyTo,BlindCopyTo)
'exemple :
'Dim recip(25) as variant
'recip(0) = "emailaddress1"
'recip(1) = "emailaddress2" e.t.c
'beDoc.sendto = recip
'-------------------------
' documents joint 1
If Len(Attach1) > 0 Then
If Len(Dir(Attach1)) > 0 Then
Set bodyAtt = bodypart.EmbedObject(EMBED
End If
End If
' documents joint 2
If Len(Attach2) > 0 Then
If Len(Dir(Attach2)) > 0 Then
Call bodyAtt.EmbedObject(EMBED_
End If
End If
'Affichage du mail dans Lotus Notes
Set workspace = CreateObject("Notes.NotesU
Call workspace.EditDocument(Tru
Set s = Nothing
Else
MsgBox "Lotus is close"
End If
End Sub
Private Sub Send_Click()
Dim html As String
html = "This <i>is</i> an <b>example</b><p>"
html = html + "<font color=purple>Wanna know where I work?</font><p>Click <a href=" & Chr(34) & "http://www.peopleware.be" & Chr(34) & ">here</a>"
CreateMailandAttachFileAdr
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the text is in a form, mark that text and click on Text/Passthru HTML.
If the value is in a formula, enclose the whole lot in "[" and "]", Notes will pass the text through as HTML.