Page 1 of 2 12>
Topic Options
#194503 - 2009-06-30 02:00 PM Dynamic Outlook Signatures
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
i have tryed using this script to setup my company's email signatur http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=189247#Post189247
but when i run the script no html is created and no signatur

if im reading the instructions right the only thing i have to do is change this
 Code:
; define static data 
; ====================================================================== 
; This is the ONE piece of user defined data that must be customized. 
; ====================================================================== 
$RootPath = '\\filserver\netlogon\emailsigs\'
; ====================================================================== 
$RootPath = '.\' ; for debugging 
 
; define the location & name of the configuration file 
$CfgFile  = $RootPath + 'config.ini'


i have made a file called config.ini and a file called Template.ini copy pasted the text from under The Config File og The Template File and placed the files in \\filserver\netlogon\emailsigs\ but im not sure that is the way to do it is there any more i have to do ?

Top
#194508 - 2009-06-30 07:21 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
You need to create an HTML file for the template, not an INI file. The INI file must be called MAILSIG.INI. You also need to get rid of the second
 Code:
$RootPath = '.\' ; for debugging 
line as it is only for debugging in the local directory!

For example, if you have this section in your MAILSIG.INI file
 Code:
[Corporate]
Format=corp.htm
Image=corplogo.jpg
you should have the corresponding CORP.HTM template and CORPLOGO.JPG image file in that folder as well. The name of the section in the INI File corresponds to the OU name. It defines the name of the template and image files to use. Image files can be any supported format, but the template should be a .HTM file and have the HTML content as shown in the example. (ie - any valid, basic HTML code.)

I see you also changed the config file name to config.ini - not recommended!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194517 - 2009-07-01 08:50 AM Re: Dynamic Outlook Signatures [Re: Glenn Barnas]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
i still dont get it. This is how it looks like now but still no signature all i get is a display of the signature file in the console

Script
 Code:
; define static data 
; ====================================================================== 
; This is the ONE piece of user defined data that must be customized. 
; ====================================================================== 
$RootPath = '\\filserver\netlogon'
; ====================================================================== 
;RootPath = '.\' ; for debugging 
 
; define the location & name of the configuration file 
$CfgFile = $RootPath + 'mailsig.ini'


In \\filserver\netlogon i have spacer.gif, default.htm and mailsig.ini

mailsig.ini
 Code:
[COMMON]
OUOffset=1
Format=default.htm
Image=spacer.gif
Restrict=
 
[Desktop Services]
Format=DTS.htm
Image=DTS.jpg
 
[Corporate]
Format=corp.htm
Image=corplogo.jpg
 
[Systems Engineering]
Format=syseng.htm
Image=imagine.jpg



default.htm
 Code:
<!--
 template for email signature - this file is used to auto-generate a signature.htm file
 - DO NOT ARBITRARILY MODIFY THIS FILE
 -->
<html>
 <head></head>
 <body>
  <!-- 
   one row by two column table with image (if any) on left, text info on right
   any &XX& replaceable field that does not have data will be removed, thus should be on separate line(s)
   -->
  <table border="0">
   <tr>
    <td>
&IMG&
     </td>
    <td>
     <font face="arial" size="3">
<b>&FULLNAME&</b>
 / &TITLE&
     <hr>
     </font><font face="arial" size="2">
&COMPANY&<br>
&DEPARTMENT&<br>
&ADDRESS&<br>
&CITY&,
&STATE&
 &POSTALCODE& <br>
&PHONENO&<br>
&FAXNO& (Fax)<br>
&CELLNO& (Cell)<br>
&WEBURL&<br>
     </font>
    </td>
   </tr>
  </table>
 </body>
</html>



Edited by graesdal (2009-07-01 12:02 PM)

Top
#194521 - 2009-07-01 01:39 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
First off.. let's run the following script. Open and run from a command prompt - kix32 userdn.kix. Then copy the resulting DN string from the screen & post it back here. We need to see if you're defining the OU offset properly.

Next, the MAILSIG.INI is an example - you need to customize it based on the OU or Department - OR - simply define the COMMON section properly if everyone is to get the same signature. SPACER.GIF is a 1x1 pixel transparent image, probably not what you want. Put your company logo into the folder and define the name in the COMMON section's IMAGE value. If you don't use an image, leave it the way you have it.

Finally, run the script from a command prompt - NOT by double-clicking or drag & drop methods. These will prevent you from seeing the diagnostic or error messages! Then, after running the CreateMailSig script (from a command prompt), CD to %APPDATA%\Microsoft\Signatures and verify that the signature files have been created there.

Oh, and since the signature file is created in HTML, go into the Outlook properties and make sure that the default message format is HTML and not RTF or TEXT.

Glenn


;; KixGenerated: 2009/05/03 22:19:03 
Break On
Dim $
 
$ = SetOption('WrapAtEOL', 'On')
 
'   User: ' @USERID ?
'User DN: ' ADSIUserInfo() ? ?
'Press any key to exit: '
Get $
 
;; 
;;====================================================================== 
;; 
;;FUNCTION       ADSIUserInfo() 
;; 
;;ACTION         Get or Set a user attribute via ADSI 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.1 / 2008/08/20 - Modified to return current UserDN when no args are specified 
;;               1.0 / 2008/03/05 
;; 
;;SYNTAX         ADSIUserInfo(User, Attribute [, Value]) 
;; 
;;PARAMETERS     User - 	OPTIONAL, AD Distinguished name. Defaults to current user 
;; 
;;               Attribute - 	OPTIONAL, Attribute value to read or set. If User and Attribute are both null, 
;;                                        the current user's DN will be returned. If User is specified and  
;;                                        Attribute is null, and error is returned 
;; 
;;               Value - 	OPTIONAL, Value to set 
;; 
;;REMARKS        Returns AD attribute value (including what was just set) 
;;               Sets an AD attribute value 
;; 
;;RETURNS        String - value of defined attribute or UserDN if no args are specified 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K, WXP, W2K3, Vista 
;; 
;;EXAMPLES        
; 
Function ADSIUserInfo(OPTIONAL $_User, OPTIONAL $_Attr, OPTIONAL $_Value)
 
  Dim $_			; temporary var 
  Dim $_D			; "$" character 
  Dim $_oUser			; User object pointer 
  Dim $_Cmd			; execute command string 
  Dim $_RtnVal			; data returned from Execute 
  Dim $_objSysInfo 		; object pointer 
 
  $_D = Chr(36)
 
  ; Determine user DN if not supplied 
  If Not $_User
    $_objSysInfo = CreateObject("ADSystemInfo")
    $_User = $_objSysInfo.UserName
    $_ = 1
    If @ERROR Exit @ERROR EndIf
    ; Return the DN if no attribute was specified 
    If Not $_Attr
      $ADSIUserInfo = $_User
      Exit 0
    EndIf
  EndIf
 
  ; Exit with error if Attribute is null 
  If Not $_Attr
    Exit 87
  EndIf
 
  ; Get the user pointer 
  $_oUser = GetObject('LDAP://' + $_User)
  If @ERROR Exit @ERROR EndIf			; exit if error creating object 
 
  ; write the value if supplied 
  If $_Value
    $_Cmd = $_D + '_oUser.put("' + $_Attr + '", "' + $_Value + '")'
    $_ = Execute($_Cmd)
    $_oUser.SetInfo
    If @ERROR
      Exit @ERROR
    EndIf
  EndIf
 
  ; read and return the current value 
  $_Cmd = $_D + '_RtnVal = ' + $_D + '_oUser.' + $_Attr
  $_ = Execute($_Cmd)
  $ADSIUserInfo = $_RtnVal
 
  Exit @ERROR
 
EndFunction
 
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194522 - 2009-07-01 01:50 PM Re: Dynamic Outlook Signatures [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Oh - one other thing comes to mind after re-reading your post. The version that's posted in the vault works, but there were a few error conditions that it did not deal with. One is when the user's SIGNATURES folder does not exist - it simply displays the HTM file on the screen. I missed that in the original code because that was also a debugging option.

For testing, open a command prompt and CD to %APPDATA%\Microsoft - verify that the Signatures subfolder exists, and create it if it doesn't. If that fixes the problem, you can add the MD %APPDATA$\Microsoft\Signatures command to the script, just before the files are written.

We will be releasing an updated version on our web site in a few weeks. Not only does V1.4 correct this issue, but it includes a tool that provides the user with the ability to customize their signature - "James" can become "Jim", and they can add their Cell #, for example. There is also a GUI tool to manage the MAILSIG.INI configuration, validating image size and dimensions, and simplifying the use of Departments and Divisions.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194526 - 2009-07-01 03:26 PM Re: Dynamic Outlook Signatures [Re: Glenn Barnas]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
this is the output of the script how do i use that in the mailsig.ini

user : MAG
User DN: CN=Martin Gręsdal, OU=Dianavej,OU=brugere,OU=Jansson,DC=public,DC=jansson,dc=dk

oh and the Signatures subfolder exists


Edited by graesdal (2009-07-01 03:28 PM)

Top
#194527 - 2009-07-01 04:05 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
This info helps you identify the OU Offset value if you will be using specific signatures for different OUs.

Does the Signature.HTM file exist in your Signatures subfolder? If it does, the script is working, but your Outlook isn't recognizing the configuration change. Some versions of outlook won't update unles it is restarted. Verify that the default message format is HTML, and that the signatures are set to Signature for new emails.

If the files are not being created, let me know, and we'll proceed with some script debugging.

Glenn


Edited by Glenn Barnas (2009-07-01 05:15 PM)
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194528 - 2009-07-01 04:21 PM Re: Dynamic Outlook Signatures [Re: Glenn Barnas]
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
I compose my signatures as business card images attached to the e-mail, a good way to make sure they are correct, and that your AD data is correct \:\)

http://www.imagemagick.org/script/ImageMagickObject.php
_________________________
The tart is out there

Top
#194539 - 2009-07-02 03:00 AM Re: Dynamic Outlook Signatures [Re: masken]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Well actually attaching images vs referencing them on a remote Web server can really save space on an Exchange mail store.

ImagMagick is also not a very secure method to use on a Windows Web Server due to it requiring excess modify rights to areas of Windows that it shouldn't really have. Works fine if all done in-house though on a local box.

Top
#194544 - 2009-07-02 11:12 AM Re: Dynamic Outlook Signatures [Re: NTDOC]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
its working now
since i have a danish version of office my signature folder is
\Microsoft\Signaturer\signature.htm
i only have one problem how do i force the users to use the signatures generated form the script, right now if the user has a signature outlook does not change to the one generated by kix

Top
#194546 - 2009-07-02 11:50 AM Re: Dynamic Outlook Signatures [Re: graesdal]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Delete everything in the folder before creating and setting the new signature.

The script below is part of our (to be implemented) logon script.
it deletes all files and folder from the signature folder if the signature folder exists. If it does not exist it creates the folder and next time the delete part will kick in. The script below requires the DirPlus() UDF. You should check if the signature folder path fits your setup.

 Code:
$signaturefolder = $appdata + "\Microsoft\Signatures\"
$folderlist = dirplus($signaturefolder, "/ad")

If Exist ($signaturefolder)
Del $signaturefolder + "*.*"
For Each $folder in $folderlist
	RD $folder /s
Next
Else
	MD $signaturefolder
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#194548 - 2009-07-02 01:36 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
The new version of the code uses a function called OutlookSignature() to get/set/delete the signature settings. You can download that UDF from my web site in the Resources section. You will need to call it once for new email and a second time for replies/forwards unless you use the same signature for both. We use a text sig for replies, and only use the image for new messages. Be sure to also download and include the dependent string conversion UDFs!

Make the call to the UDF right after the signature files are created.

Our new code can optionally delete all prior signatures before creating the company standard sigs. This was made an option since some executives use two signatures, depending on which division they need to represent. The second sig is created manually for them, so we can't just delete it. If you choose to delete prior sigs, do it before anything else is created.

Glenn

PS - Would you like to try version 1.4 and assist in the process to support internationalization? The code is solid and deployed in several sites and over 4000 desktops, but is US-English only at this time. Send me a PM with your email if you are interested.
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194549 - 2009-07-02 01:41 PM Re: Dynamic Outlook Signatures [Re: masken]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
The one problem I see with this approach, from a strictly mail standpoint, is that you may not have enough control over the image size. Large images, generally over 32K in fact, can trigger SPAM filters on many inbound mail servers. This can delay or prevent delivery of email.

We keep our images small, and the HTML or text signature is insignificant. Of course, it limits the text portion to use of universally available fonts, but this is rarely an issue.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194604 - 2009-07-07 03:33 PM Re: Dynamic Outlook Signatures [Re: Glenn Barnas]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
ok so now this script is working for me and alot of my users are using it i have one problem with one of my users he has 2 computers both with windows xp and office the script works fine on one of his computer however one the other the kix runs and generates a signature.htm in the signature folder but the file is emty
Top
#194606 - 2009-07-07 03:39 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Looks like the script has some issues getting data from AD one the system where the signature is empty.

It can be useful to make a copy of the script for testing, put some debugging lines in it to show the data from AD on the screen and run the script manually on that specific system.


Edited by Mart (2009-07-07 03:39 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#194610 - 2009-07-07 06:51 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Is this issue with the version 1.5 that I sent you?

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#194611 - 2009-07-07 08:07 PM Re: Dynamic Outlook Signatures [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
1.5 and we only have 1.1 here \:\(
Top
#194612 - 2009-07-08 07:42 AM Re: Dynamic Outlook Signatures [Re: NTDOC]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
this issue is with 1.1 i only use 1.5 for testing on my own system. if i make a debug and show the output of the signature in the console it shows all the information from ad but still the signature.htm file is emty on one of his computers
Top
#195813 - 2009-09-09 03:29 PM Re: Dynamic Outlook Signatures [Re: graesdal]
graesdal Offline
Fresh Scripter

Registered: 2007-12-04
Posts: 25
the script 1.1 runs ok now i only have one problem when i reply somone how writs to me in plain text or rtf there is no signature i know that this script is html but i really want some kind of signature (just name and address) in my plain text mails.
can i do something that writes something in my signature.txt and signature.rtf


Edited by graesdal (2009-09-09 03:33 PM)

Top
#195820 - 2009-09-09 06:15 PM Re: Dynamic Outlook Signatures [Re: graesdal]
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I modified the original code to remove the dependancy on the external htm file and image

We have only a basic signature requirement, so I dumbed the code down quite a bit.

 Code:
	$ldap = TranslateName(1, @domain, 3, @ldomain+'\'+@userid, 1)
	$UPs = GetObject('LDAP://'+$LDAP[0])
		$FirstName	= $UPs.FirstName
		$MiddleName	= $UPs.initials
		$LastName	= $UPs.LastName
		$sOffice 	= $UPs.physicalDeliveryOfficeName
		$sTitle		= $UPs.Title
		$sEmail		= $UPs.mail
		$sDepartment	= $UPs.Department
		$sStreetAddress	= $UPs.StreetAddress
		$sCity		= $UPs.L
		$sState		= $UPs.St
		$sPostalCode	= $UPs.PostalCode
		$sCountry	= $UPs.Co
		$sPhoneNumber	= $UPs.telephoneNumber
		$sFaxNumber	= $UPs.FacsimileTelephoneNumber
		$sCellNumber	= $UPs.Mobile
		$sWebPage	= $UPs.wWWHomePage
		$SigImage = 'http://www.website.com/Shared/Images_pres/Logo.PNG'	; Company Logo left side image
		$BarImage = 'http://intranet/SiteCollectionImages/ChallengeLogo.png'		; Button bar graphic - right side
		$BarLink  = 'http://intranet/Challenge/default.aspx'				; hyperlink for button bar 

		$SigData = '<html><head></head><body><br><br><hr><table border="0"><tr><td align="center" valign="bottom" style="width: 200px">' +@crlf
			 + '<img border=0 width=184 height=78 src="' + $SigImage + '">' +@crlf + '</td><td align="center" valign="bottom" style="width: 400px"><font face="arial" size="3">' +@crlf
			 + '<b>'+$FirstName +' '+ $lastname+'</b>' +@crlf + '</font><font face="arial" size="2">' +@crlf + ' - '+$sTitle +@crlf + '<hr>' +@crlf
			 + $sOffice +' - ' +@crlf +$sDepartment +'<br>' +@crlf + $sStreetAddress+'<br>' +@crlf + '$sCity,' +@crlf + '$sState' +@crlf + ' $sPostalCode <br>' +@crlf
			 + $sPhoneNumber+' (Office)<br>' +@crlf + $sFaxNumber +' (Fax)<br>' +@crlf + $sEmail +'<br>' +@crlf + '</font></td>' +@crlf + '<td align="center" valign="bottom" style="width: 200px">' +@crlf
			 + '<a href="' + $BarLink + '"><img border=0 width=190 height=48 src="' + $BarImage + '"</p>' +@crlf + '</tr></table><table border="0"><tr><td Width="800" align="center"><font face="arial" size="1">' +@crlf
			 + 'Privacy Statement:  This e-mail may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. '
			 + 'If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or'
			 + ' copying of this e-mail is prohibited.  If you have received this in error, please reply to the sender and delete it immediately.' +@crlf
			 + '</font></tr></td></table><br></body></html>'
		$SigFile = ExpandEnvironmentVars(%appdata%) + '\Microsoft\Signatures\_Default.htm'
		Del $SigFile
		$SigData = Split($SigData, @CRLF)
		$nul = WriteFile($SigFile,$SigData)


Edited by Radimus (2009-09-09 06:17 PM)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1003 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.083 seconds in which 0.028 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org