Generating Outlook Signatures Based on Active Directory Information - Finishing the Signature File
(Page 4 of 4 )
Now that we have the basics down, let's create the rest of the file using the same method:
If UserObj.telephoneNumber <> "" then CreateSigFile.WriteLine "<DIV align=left><FONT face=Arial color=#808080 size=1>" & "Tel: " & "</font><FONT face=Arial color=#808080 size=2>" & UserObj.telephoneNumber & "</FONT></DIV>"
If UserObj.mobile <> "" then CreateSigFile.WriteLine "<DIV align=left><FONT face=Arial color=#808080 size=1>" & "Mob: " & "</font><FONT face=Arial color=#808080 size=2>" & UserObj.mobile & "</FONT></DIV>"
If UserObj.mail <> "" then CreateSigFile.WriteLine "<DIV align=left><FONT face=Arial color=#808080 size=1>Email: <A href=" & strQuteChr & "mailto:" & UserObj.mail & strQuteChr & ">" & UserObj.mail & "</A></FONT></DIV>"
If UserObj.wWWHomePage <> "" then CreateSigFile.WriteLine "<DIV align=left><FONT face=Arial color=#808080 size=1>" & "Web: " & "</font><FONT face=Arial color=#808080 size=1><A href=" & strQuteChr & UserObj.wWWHomePage & strQuteChr & ">" & UserObj.wWWHomePage & "</A></FONT></DIV>"
CreateSigFile.WriteLine "<DIV align=left><FONT face=Arial size=2></FONT><br></DIV>"
'append the image
strLogoPath = "http://www.myorg.com/logos/email_sig.jpg
CreateSigFile.WriteLine "<DIV align=left><IMG alt=" & strQuteChr & UserObj.company & strQuteChr & " hspace=0 src=" & strQuteChr & strLogoPath & strQuteChr & " border=0> </DIV>"
CreateSigFile.WriteLine "</BODY></HTML>"
CreateSigFile.Close
In addition to adding the user's contact details to the signature file, we have also added a company logo. Remember, because it is an HTML document, we can do quite a bit with it.
Now save the script and run it. If all goes according to plan, you should see a new HTML file in your signatures directory that you can use as your signature. If you are a Microsoft Outlook user, go to options and under the mail format tag, you should see your new file in the available signature drop down.
Improving the Script
Of course, there are a few things that could help improve the script. You could base the company logo on an active directory group or organizational unit, check for the existence of Outlook before creating the script, and automatically make your signature the default one in Outlook. There's quite a bit of room for improvement, but this script should give you a good base from which to start.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |