Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text Color in Email

Status
Not open for further replies.

jdwm2310

Technical User
Jul 26, 2001
396
US
Hi Guys,

I created a message to be sent via Lotus Notes but I would like to know if I can add color text to the message. Is this possible?
 
I see this question was never answer, in the forum. Did you ever get the answer? Let me know please
 
No answer yet. I would appreciate if someone could lend me a hand...thanks
 
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,

Earl [yinyang]
 
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

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
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 <> &quot;&quot; Then
Set AttachME = MailDoc.CREATERICHTEXTITEM(&quot;Attachment&quot;)
Set EmbedObj = AttachME.EMBEDOBJECT(1454, &quot;&quot;, Attachment, &quot;Attachment&quot;)
MailDoc.CREATERICHTEXTITEM (&quot;Attachment&quot;)
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(&quot;Notes.NotesSession&quot;)
With NotesSS

Set NotesDb = .GETDATABASE(&quot;WAKEAM3/WYP&quot;, &quot;mail\721116.nsf&quot;)

End With

With NotesDb
'Start a session to notes
Set session = CreateObject(&quot;Notes.NotesSession&quot;)
'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(&quot;&quot;, MailDbName)

If Not (MailDb.ISOPEN) = True Then MailDb.OPENMAIL

'Set up the new mail document
Set MailDoc = MailDb.CREATEDOCUMENT
With MailDoc
.Form = &quot;Memo&quot;
.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(&quot;Body&quot;)
Call richText.APPENDTEXT(&quot;Now listen up&quot;)
Call richText.ADDNEWLINE(1)
richStyle.Bold = True
Call richText.APPENDSTYLE(richStyle)
Call richText.APPENDTEXT(&quot;The meeting is at &quot;)
richStyle.NOTESCOLOR = 11
Call richText.APPENDSTYLE(richStyle)
Call richText.APPENDTEXT(&quot;3:00&quot;)
richStyle.NOTESCOLOR = COLOR_Magenta
Call richText.APPENDSTYLE(richStyle)
Call richText.APPENDTEXT(&quot; not 2:00&quot;)

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

&quot;Where are all the stupid people from...
...And how'd they get so dumb?&quot;
NoFX-The Decline
----------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top