I was wondering if it was possible to send an email in lotus script that includes an image? I don’t want the image to be an attachment that a user clicks on to view but to be part of the email itself, a bit like a header on a letter. I’ve been looking in the help to see if it can be done through using a rich text field, with embed object but so far no luck (this could be my inexperience causing it not to work properly). I am hoping to send the email to users who are external and who are not on notes and would really like the company logo to feature on the email. The only ideas I have had is to convert the email into a word doc and send the word doc as an attachment which a user would have to click on to view the actual message of the email but would rather use just one email with the logo and message both included. Any suggestions or resolutions would be greatly received.
Your post says “All releases”, so I was wondering if you might be using 8.5 or higher by any chance? If so, you can take advantage of the undocumented NotesUIDocumentImportItem method, by storing the header in a profile document or similar.
Beware though, in 8.5.2 a carriage return is inserted before the rich text. This was fixed for 8.5.3.
If you’re not using 8.5+, there is another way of setting a default value of a rich text field - I haven’t tried using this since R5, so beware!
You can write out a mime type email and add an html reference for an image on your file server. If this is an option for you just take the example below and add lines of code to reference the image.
The example below creates a workflow email to a Google mail account with an html link to open our lotus notes workflow document directly without navigating to it. Just retrofit the below to your needs to format an html page with an image and text in it. Here is what the 2 lines of code would look like to add an image:
strBody =|| + |
|
Call stream.WriteText(strBody)
Hope it helps…
Here is the full code I’m using but just change it to do what you need.
’ ***************** MIME Type Email
’
Dim stream As NotesStream
Dim mimeBody As NotesMimeEntity
Dim mimechild As NotesMimeEntity
Dim header As NotesMimeHeader
Set stream = session.CreateStream
Set mimeBody = maildoc.CreateMIMEEntity
Set mimeChild = mimeBody.CreateChildEntity
Dim strBody As String
Dim universalID As String*32
strBody =|<br>| + "Ticket " + doc.TicketIdentifier(0) + " has been submitted to you." + |<br><br>|
Call stream.WriteText(strBody)
strBody =|<br>| + "Caller: " + doc.Caller(0) +|<br> |
Call stream.WriteText(strBody)
strBody = "Summary: " + doc.ProblemSummary(0) + |<br> |
Call stream.WriteText(strBody)
strBody ="Description: " + doc.ProblemType(0) + " - " + doc.SubCat2(0) + |<br><br><br> |
Call stream.WriteText(strBody)
strBody ="Resolve By Date: " + doc.ResolveByDate(0) + |<br><br><br> |
Call stream.WriteText(strBody)
strBody = |Promise Date: | & doc.PromiseDate(0) & |<br>|
Call stream.WriteText(strBody)
strBody = |Priority: | & doc.Priority(0) & |<br>|
Call stream.WriteText(strBody)
Dim temp As String
If doc.TicketIdentifier(0) ="" Then
temp = "Ticket Number not Assigned"
Else
temp = doc.TicketIdentifier(0)
End If
Eval = Evaluate("@UpperCase(@Name([CN];@ServerName))", doc)
Eval2 = Evaluate("@WebDbName", doc)
universalID = doc.UniversalID
strBody = "Click here to review the document titled: <a href=notes://" & Eval(0) + "/" & Eval2(0) & "/0/" & universalID & "?editdocument>" & temp +"</a>"
Call stream.WriteText(strBody)
strbody= "<BR>" & "<BR>"
Call stream.WriteText(strBody)
Call stream.WriteText(strBody)
Call mimeChild.SetContentFromText(stream, "text/html", ENC_NONE)
Call stream.Close
Call stream.Truncate
Set mimeChild = mimeBody.CreateChildEntity
Set header = mimeChild.createHeader("Content-Type")
Call header.setHeaderVal("multipart/mixed")
Call stream.Close
Call stream.Truncate
Call maildoc.Send( False )
I’ve tried numerous way but can’t get any to look how I want. Thank you all anyway for the advice. I’ve currently changed the way I’m doing things by emailing the word document as an attachment. I’ve set up the word document, and saved it in a parameter document in the db. When the user clicks the button, I’m getting the word doc from the parameter then getting the information off my form to write across to the word document, saving it temporarily in the h: drive and then i send the mail with the attachment. Once I have done this I then delete the temporary document from the H:drive. This works perfectly on my machine and other collegues machines but not for my user which is strange. The user gets the error message “This method or property is not valid because a document window is not active” any ideas?