Subject: RE: How to embed a picture (logo) in an e-mail for use in a HTML signature?
Ben,
As far as I can tell, I’ve managed to add the image as an inline MIME part with the following code. However, I still have two issues:
(1) I’ve tried placing the code in a number of the form events (QuerySave, Queryclose etc…) so that the graphic is added during document creation, but for some reason the MIME Part only becomes visible (the message size increases and an item appears in the Document properties) after opening and closing (or resaving, depending on the form event) the delivered document for the first time. When the message first arrives in the Inbox, there is no MIME Part (judging by the file size & properties).
(2) I can’t get the picture to display in my signature! I’m not sure how to reference the Content-ID in my HTML code (already tried ‘img src = cid:logo.bmp’). If I change the content disposition to ‘attachment’, I can view the image ok, so it must just be a linkage issue (?).
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim nMIMEEnt As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim db As NotesDatabase
Dim stream As NotesStream
Dim FileName As String
Dim workspace As New NotesUIWorkspace
Dim ses As New NotesSession
Set db = ses.CurrentDatabase
ses.ConvertMIME = False
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set nMIMEEnt = doc.GetMIMEEntity(“CompanyLogo”)
If (nMIMEEnt Is Nothing) Then
Set nMIMEEnt = doc.CreateMIMEEntity("CompanyLogo")
Set header = nMIMEEnt.CreateHeader("Content-Disposition")
Call header.SetHeaderVal("inline; filename=logo.bmp")
Set header = nMIMEEnt.CreateHeader("Content-ID")
Call header.SetHeaderVal("<logo.bmp>") <- also tried "logo.bmp"
Set header = nMIMEEnt.CreateHeader("Content-Transfer-Encoding")
Call header.SetHeaderVal("Base64")
Set stream = ses.CreateStream()
FileName = "c:\logo.bmp"
Call stream.Open(FileName)
Call nMIMEEnt.SetContentFromBytes(stream,"image/bmp",ENC_NONE)
Call nMIMEEnt.EncodeContent(ENC_BASE64)
Call stream.close
Call doc.CloseMIMEEntities(True)
Call doc.Save(True,False,True)
End If
MIME Part properties:
Field Name: CompanyLogo
Data Type: MIME Part
Data Length: 165 bytes
Seq Num: 2
Dup Item ID: 0
Field Flags: SIGN SEAL
"Content-Transfer-Encoding: binary
Content-Type: image/bmp
Content-Disposition: inline;
filename=logo.bmp
Content-ID: <logo.bmp>
logo.bmp"
Got any ideas?
Paul.