then the signature block is there, but the attachment is not copied (missing) from the email. It seems that the default Lotus Notes template is being used.
I need help with the code so that a HTML format email with attachment is created that uses the default template and has the signature block inserted. I think the "CreateDocument" and "ComposeDocument" commands use two different templates.
Well, CreateDocument is back-end and ComposeDocument is front-end, but I use front-end and back-end classes together all the time. You just need to be aware of the differences, how they relate, and when to use each. The reason that CreateDocument does not set the signature is because there are no hooks that allow the developer to extend the functionality. When ComposeDocument is used, however, code in the Form's events are executed. This is how you extend functionality of the ComposeDocument and EditDocument methods. The Memo form probably uses the QueryOpen or PostOpen event to check whether the document is new - if it is, the signature is added.
The best solution is to create the document in the backend adding in the signature as specified by the CalendarProfile document (you could look at the Lotus code to see how they are doing this), then display it to the user using ws.EditDocument.
That's a lot of work, though. As a workaround, I have done this in the past...
1) Create back-end document using mime or richtext.
2) Display it temporarily using ws.EditDocument. (it is open for only an instant. most users won't notice)
3) Copy the body to the clipboard using uidoc.Copy.
4) Close the temp uidoc.
5) Compose new memo.
6) Paste in the body using uidoc.Paste.
Not the best solution because it destroys the contents of the clipboard, but it is the only way I have found to compose a mime or richtext memo with a signature.
Sjef Bosman
> You just need to be aware of the differences...
With an emphasis on "just"... ;-) I mentioned "better not", for the reasons you mentioned and also the fact that rich-text fields aren't synchronised.
I almost agree with the last sentence, for it should be possible to include the Signature from the profile document using only the back-end class. Also a lot of work...
waverazor
ASKER
Sjef,
Using the code below got me the signature, but the new line characters where not recognized in the html email. My signature appeared like this (on one line): Donald Duck Any Company 123 Main St (123) 456-7890.
Dim profdoc As Notesdocument
Set profdoc = maildb.GetProfileDocument("CalendarProfile").("Signature")(0)
I added this like of code and the signature is formated with line breaks:
You've help me very much in the past. The code I use is yours. I believe that I have already tried what you suggest in your workaround (the 3rd block of code in my 1st posting), but the attachment does not get copied to the new email. When I use the 2nd block of code in the 1st posting (I get the attachment, but I lose the signature) the attachment is not in the body of the email, but in the heading portion to the left of the To, cc, bcc, and subject lines. Maybe this location is why it is not copied to the new email? If my 3rd block of code is not what you suggest, please provide a code sample.
I just tested, and you're right. My workaround no longer works because 8.5 changes the way that MIME attachments are displayed. Since they are no longer rendered in the body field, the copy-paste solution no longer works.
The only true solution I know of is to code the 'insert signature' part by hand. I would start by looking at the UIMemoDocument.InsertSignature method in the mail file design. It should have everything you need.
waverazor
ASKER
The solution should include: profdoc.GetItemValue("Signature")(0) to get the text signature.
However, this will not work for a HTML signature. For a HTML signature I read the HTML file and appended the contents to the body.
The best solution is to create the document in the backend adding in the signature as specified by the CalendarProfile document (you could look at the Lotus code to see how they are doing this), then display it to the user using ws.EditDocument.
That's a lot of work, though. As a workaround, I have done this in the past...
1) Create back-end document using mime or richtext.
2) Display it temporarily using ws.EditDocument. (it is open for only an instant. most users won't notice)
3) Copy the body to the clipboard using uidoc.Copy.
4) Close the temp uidoc.
5) Compose new memo.
6) Paste in the body using uidoc.Paste.
Not the best solution because it destroys the contents of the clipboard, but it is the only way I have found to compose a mime or richtext memo with a signature.