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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Format HTML email using VB and Lotus Notes

Status
Not open for further replies.

JugglerVein

Programmer
Feb 8, 2005
1
FR

I am using VB (and VBA) to automate Lotus Notes, format email messages, and send them to people within the company (recipients also use Notes). I attach html files using the code as well. My problem is I would like to send the html within the body of the email so recipients don't have to open the attachment. Sending html in the body just displays the html, not the formatted page. I have tried setting content-type and could not get to work I have scoured the web and cannot find a solution. Below is the code I'm using...

Code:
Sub NotesMailSendAttachFile(sTo As Variant, _
                                 sSubject As String, _
                                 sBody As String, _
                                 sAttach As String)

Dim nSession As Object
Dim nDatabase As Object
Dim nMailDoc As Object
Dim nSendTo(60) As String 'array for 60 e-mail address
Dim EmbeddedObj As Object
Dim Attach1 As String
Dim AttachMe

Set nSession = CreateObject("Notes.NotesSession")
Set nDatabase = nSession.GetDatabase("", "")
Call nDatabase.OPENMAIL

Attach1 = sAttach

Set nMailDoc = nDatabase.CreateDocument
'nSendTo(0) = sTo
With nMailDoc
    .Form = "Memo"
    .Body = sBody
    .SendTo = sTo 'nSendTo
    .Subject = sSubject
    .Importance = "0"
    If (Attach1 <> "") Then
        Set AttachMe = .CreateRichTextItem("attach1") '"mshtmldata")
        Set EmbeddedObj = AttachMe.EmbedObject(1454, "attachment1", Attach1)
    End If
    .Send (False)
End With

Set nDatabase = Nothing
Set nMailDoc = Nothing
Set AttachMe = Nothing
Set nSession = Nothing
Set EmbeddedObj = Nothing

End Sub

Any help is appreciated



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top