I dont know much about Lotus Notes but I had some similar issues using winsock. The solution I found was to set the Content-Type in the email header to text/html. This way I could use html tags in the email. If you could somehow get this set in the email you are sending then you could try to use the font tag to set the color. I really dont how you would do this in Lotus Notes but this is something to consider. Hope this helps,
AFAIK you can't send html mail thru Lotus notes, at least I can't here!
You need to be looking at the rich text object in Notes. I will post anything I can find shortly.
Ben ----------------------------------------------
Ben O'Hara
OK, sorted it!
You do need to use the RichTextItem property.
Here is my hacked together code:
Const COLOR_BLACK As String = 0
Const COLOR_BLUE As String = 4
Const COLOR_CYAN As String = 7
Const COLOR_DARK_BLUE As String = 10
Const COLOR_DARK_CYAN As String = 13
Const COLOR_DARK_GREEN As String = 9
Const COLOR_DARK_MAGENTA As String = 11
Const COLOR_DARK_RED As String = 8
Const COLOR_DARK_YELLOW As String = 12
Const COLOR_GRAY As String = 14
Const COLOR_GREEN As String = 3
Const COLOR_LIGHT_GRAY As String = 15
Const COLOR_MAGENTA As String = 5
Const COLOR_RED As String = 2
Const COLOR_WHITE As String = 1
Const COLOR_YELLOW As String = 6
Sub ffSendNotesMail(Subject As String, Attachment As String, Recipient As String, cc As String, BodyText As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim MailDb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself NotesDocument
Dim MailDoc2 As Object
Dim AttachME As Object 'The attachment richtextfile object
Dim session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim CurrentDatabase As String
Dim NotesSS As Object
Dim NotesDb As Object
'On Error GoTo Errshow:
Set NotesSS = CreateObject("Notes.NotesSession"
'notess.initialize "finlay2000"
With NotesSS
Set NotesDb = .GETDATABASE("WAKEAM3/WYP", "mail\721116.nsf"
NotesDb.Initialize "finlay2000"
End With
With NotesDb
'Start a session to notes
Set session = CreateObject("Notes.NotesSession"
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = session.UserName
MailDbName = NotesDb.FileName
Set MailDb = session.GETDATABASE("", MailDbName)
If Not (MailDb.ISOPEN) = True Then MailDb.OPENMAIL
'Set up the new mail document
Set MailDoc = MailDb.CREATEDOCUMENT
With MailDoc
.Form = "Memo"
.sendto = Recipient
.CopyTo = cc
.Subject = Subject
.body = BodyText
.SAVEMESSAGEONSEND = SaveIt
End With
'Set up the embedded object and attachment and attach it
If Attachment <> "" Then
Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment"
Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment"
MailDoc.CREATERICHTEXTITEM ("Attachment"
End If
End With
'Send the document
MailDoc.SEND 1, Recipient
Cleanup:
Set MailDb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set session = Nothing
Set EmbedObj = Nothing
Exit Sub
Errshow:
MsgBox (Err.Description)
GoTo Cleanup
End Sub
Sub fSendNotesMailRT(Subject As String, Recipient As String, SaveIt As Boolean)
'Set up the objects required for Automation into lotus notes
Dim MailDb As Object 'The mail database
Dim UserName As String 'The current users notes name
Dim MailDbName As String 'THe current users notes mail database name
Dim MailDoc As Object 'The mail document itself NotesDocument
Dim MailDoc2 As Object
Dim AttachME As Object 'The attachment richtextfile object
Dim session As Object 'The notes session
Dim EmbedObj As Object 'The embedded object (Attachment)
Dim CurrentDatabase As String
Dim NotesSS As Object
Dim NotesDb As Object
'On Error GoTo Errshow:
Set NotesSS = CreateObject("Notes.NotesSession"
With NotesSS
Set NotesDb = .GETDATABASE("WAKEAM3/WYP", "mail\721116.nsf"
End With
With NotesDb
'Start a session to notes
Set session = CreateObject("Notes.NotesSession"
'Get the sessions username and then calculate the mail file name
'You may or may not need this as for MailDBname with some systems you
'can pass an empty string
UserName = session.UserName
MailDbName = NotesDb.FileName
Set MailDb = session.GETDATABASE("", MailDbName)
If Not (MailDb.ISOPEN) = True Then MailDb.OPENMAIL
'Set up the new mail document
Set MailDoc = MailDb.CREATEDOCUMENT
With MailDoc
.Form = "Memo"
.sendto = Recipient
.CopyTo = cc
.Subject = Subject
.SAVEMESSAGEONSEND = SaveIt
End With
'Set up the embedded object and attachment and attach it
Dim richStyle As Object
Dim richText As Object
Set richStyle = session.CREATERICHTEXTSTYLE
Set richText = MailDoc.CREATERICHTEXTITEM("Body"
Call richText.APPENDTEXT("Now listen up"
Call richText.ADDNEWLINE(1)
richStyle.Bold = True
Call richText.APPENDSTYLE(richStyle)
Call richText.APPENDTEXT("The meeting is at "
richStyle.NOTESCOLOR = 11
Call richText.APPENDSTYLE(richStyle)
Call richText.APPENDTEXT("3:00"
richStyle.NOTESCOLOR = COLOR_Magenta
Call richText.APPENDSTYLE(richStyle)
Call richText.APPENDTEXT(" not 2:00"
End With
'Send the document
MailDoc.Save True, False
MailDoc.SEND False
Cleanup:
Set MailDb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set session = Nothing
Set EmbedObj = Nothing
Exit Sub
Errshow:
MsgBox (Err.Description)
GoTo Cleanup
End Sub
The styles you can apply are:
Bold
Effects
FontSize
Italic
NotesColor
NotesFont
Strikethrough
Underline
hth
Ben
One day I will get round to putting this into an easy to use class!! ----------------------------------------------
Ben O'Hara
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.