Friday, July 14, 2006

Helping Your Users to Create HTML Signatures

I was a little stuck for new Notes material for this blog until I read the brilliant Alan Lepofsky's article on creating Signature files for Lotus Notes.

Full URL of his Article
http://www.alanlepofsky.net/alepofsky/alanblog.nsf/dx/creating-a-simple-html-signature-file

His article provides a simple step-by-step guide to creating a signature using HTML and is very easy to follow but, as Notes Administrators and Developers, I feel that we have greater responsibility to protect our lower-level users from any kind of programming, so I'm going to post some code that I've been using.

Where to put the Code
Originally, I had this code built-in to our corporate mail template. You can do this if you want but the problem with building things into the mail template is that you have to remember to carry them through to the any new templates whenever you upgrade.

A more elegant solution IMHO is to put the code into an instruction manual.


My Instructions
The following are the instructions on my "document".


The following procedure will simplify installation of your signature and disclaimers.

Please note the following;


  • You need to perform steps 1-7 the first time, but can make changes in future by doing only step 1.

  • You do not have to supply your three digit telephone extension.

  • You do not have to supply a mobile number.

  • Your email address is a system guess... check (and retype if required) before accepting.



Having done the procedure, you can test it by creating a new mail memo.

Steps to Complete


  1. Click the button on the Right and answer the questions it asks.

  2. From the Lotus Notes menu, select Tools, and then Preferences.

  3. Click on the tab marked Signature

  4. Tick the box marked [x] Automatically append a signature to the bottom of my outgoing mail messages

  5. Select the option marked (o) HTML or Image File

  6. In the File section type: H:\NotesSig.html

  7. Click on the button marked OK




The Code
Please remember that I can't use HTML here so please replace all instances of { and } with <>.

I then have a button which contains the following code...


Sub Click(Source As Button)

Dim YourName As String
Dim DefaultName As Variant
Dim YourPosition As String
Dim DBName As String
Dim DefaultEmail As Variant
Dim YourEmail As String
Dim YourMobile As String
Dim YourExtension As String
Dim Session As New NotesSession

DefaultName = Session.CommonUserName

YourName = Inputbox$ ("What is your Name: " ,"Full Name" , DefaultName)
YourPosition = Ucase$(Inputbox$ ("What is your Job Title: " ,"Job Title" , ""))
DBName = Session.CurrentDatabase.FileName
DefaultEmail = Trim$(Left$(DBName, (Len(DBName) - 4))) + "@mydomain.com"
YourEmail = Inputbox$("What is your Email Address" , "Email" , DefaultEmail)
EmailLine = "{A HREF=" + Chr$(34) + "MailTo:" + YourEmail + Chr$(34) + "}" + YourEmail + "{/A}{br}"
YourExtension = Inputbox$("Enter the (three digit) extension for your direct number (or blank for none): ", "Phone")
YourMobile = Inputbox$("Enter your mobile number (or blank for none): ", "Mobile Phone")

Open "H:\NotesSig.html" For Output As #1
Print #1, "{FONT FACE="+ Chr$(34) + "Default Sans Serif"+ Chr$(34) +" SIZE=2}{br}{br}{br}{B}"
Print #1, YourName
Print #1, "{/B}{br}"
Print #1, YourPosition
Print #1, "{br}My Company Name{br}{br}Email:"
Print #1, EmailLine

If Trim$(YourExtension) {} "" Then
Print #1, "Phone: 61 2 9216 4" + YourExtension + "{br}"
End If

If Trim$(YourMobile) {} "" Then
Print #1, "Mobile: "+ YourMobile + "{br}"
End If

Print #1, "{br}{br}{hr}{br}{/FONT}{FONT FACE="+ Chr$(34) + "ARIAL"+ Chr$(34) +" SIZE=1}"

Print #1, "This message may contain confidential and/or privileged information, and is intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message you must not disseminate, copy or take any action in reliance on it. If you have received this message in error, please notify us immediately, by telephone (Sydney 61 2 9999 5555) or e-mail ({A HREF=" + Chr$(34) + "Mailto:support@mydomain.com" + Chr$(34) + "}support@mydomain.com{/A})."

Print #1, "{br}{br}{B}My Company Name{/B}{br}"
Print #1, "ABN: xx xxx xxx xxx{br}"
Print #1, "Level 99, 01 Location Street SYDNEY NSW 2000{br}"
Print #1, "Phone: 61 2 9999 5555{br}Fax: 61 2 9999 6666{br}"
Print #1, "Web Site: {A HREF=" + Chr$(34) + "http://www.mydomain.com" + Chr$(34) + "}www.mydomain.com{/A}{br}"
Print #1, "{br}{hr}{/FONT}"

Close #1

Msgbox "You can now do Step 2 onward",64,"Finished"

End Sub



Obviously, you'll need to modify the domain name and addresses fields.

You'll probably want to change the storage location (I use the user's Home (H:) drive so that Notes signatures follow them around the network. Laptop users should use the Local Drives (C:/D:) for obvious reasons.

Also, you might want to remove the disclaimer information depending upon where your disclaimer is attached. (if it is attached at server-level).

Improvements
This code is far from perfect and some of the things I think could be done to improve it include;


  • Doing a lookup of the name to retrieve the email address.

  • Programmatically turn the HTML file options on in the Notes local address book.



Hope you can benefit from this code.