VBScript: create an HTML Outlook email signature for the whole company

In one of my previous articles, I’ve shown how to create simple email signatures in Outlook using VBScript. In this article, I will show you how to take your email signatures to a higher level. I will use VBScript to create an HTML email signature for every Outlook (for Windows) installation in your organization. The script will create a professional email signature with data taken from Active Directory. Next, I will explain how to use GPO to distribute the script to every user in your organization.

Active Directory Outlook Signatures VBScript HTML

Creating HTML with VBScript

Before you proceed, a short explanation about creating an HTML file with VBScript. Both VBScript and HTML languages use double quotation marks (“) as the default characters for specifying data input. That generates a problem, at least in this scenario. If you try to use single quotation marks for data input in VBScript, you will end up in converting the entire script into a single huge comment. There are two methods which will let us work around this issue:

  1. Adding & “”” after each double quotation mark found in HTML code (method used in Script 1). Just be sure to add a space before the & character as well.
  2. Changing all double quotation marks to single quotation marks in HTML code (method used in Script 2).

I prefer method 2, as it results in a cleaner code and it’s easy to use e.g. Notepad to replace all ” with ‘ in a source HTML file.

In addition to those methods, you could use only a single WriteLine method and create one-line HTML code. Although it might make the method used in Script 2 slightly easier, you will greatly decrease readability of your code.

Sample VBScripts

First, you need to create a script which will create a personalized HTML email signature for each user. Below, I will present two different sample scripts which create two different signature templates. Those samples use slightly different methods to generate HTML code.

The base HTML code for signature templates originates from the free email signature generator.

Important! Both scripts include a section with global placeholders. They relate to data that should be identical for every user (company address, social media websites, etc.). Make sure to replace their values with your company’s data.

Script 1

The first sample script will let you create the following signature template:

Script 1 sample HTML email signature template
Click to expand/hide Script 1
On Error Resume Next

'Setting up the script to work with the file system.
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FileSysObj = CreateObject("Scripting.FileSystemObject")

'Connecting to Active Directory to get user’s data.
Set objSysInfo = CreateObject("ADSystemInfo")
Set UserObj = GetObject("LDAP://" & objSysInfo.UserName)
strAppData = WshShell.ExpandEnvironmentStrings("%APPDATA%")
SigFolder = StrAppData & "\Microsoft\Signatures\"
SigFile = SigFolder & UserObj.sAMAccountName & "1.htm"

'Setting placeholders for the signature.
strUserName = UserObj.sAMAccountName
strFullName = UserObj.displayname
strTitle = UserObj.title
strMobile = UserObj.mobile
strEmail = UserObj.mail
strCompany = UserObj.company
strOfficePhone = UserObj.telephoneNumber

'Setting global placeholders for the signature. Those values will be identical for all users - make sure to replace them with the right values!
strCompanyLogo = """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/logo.png"
strCompanyAddress1 = "16 Freedom St, Deer Hill"
strCompanyAddress2 = "58-500 Poland"
strWebsite = """https://www.my-company.com"
strFacebook = """https://www.facebook.com/"
strTwitter = """https://www.twitter.com/"
strYouTube = """https://www.youtube.com/"
strLinkedIn = """https://www.linkedin.com/"
strInstagram = """https://www.instagram.com/"
strPinterest = """https://www.pinterest.com/"

'Creating HTM signature file for the user's profile, if the file with such a name is found, it will be overwritten.
Set CreateSigFile = FileSysObj.CreateTextFile (SigFile, True, True)

'Signature’s HTML code.
CreateSigFile.WriteLine "<!DOCTYPE HTML PUBLIC " & """-//W3C//DTD HTML 4.0 Transitional//EN" & """>"
CreateSigFile.WriteLine "<HTML><HEAD><TITLE>Email Signature</TITLE>"
CreateSigFile.WriteLine "<META content=" & """text/html; charset=utf-8" & """ http-equiv=" & """Content-Type" & """>"
CreateSigFile.WriteLine "</HEAD>"
CreateSigFile.WriteLine "<BODY style=" & """font-size: 10pt; font-family: Arial, sans-serif;" & """>"
CreateSigFile.Writeline "<table style=" & """width: 420px; font-size: 10pt; font-family: Arial, sans-serif;" & """ cellpadding=" & """0" & """ cellspacing=" & """0" & """>"
CreateSigFile.Writeline "<tbody>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td width=" & """130" & """ style=" & """font-size: 10pt; font-family: Arial, sans-serif; border-right: 1px solid; border-right-color: #008080; width: 130px; padding-right: 10px; vertical-align: top;" & """ valign=" & """top" & """ rowspan=" & """6" & """> <a href=" & strWebsite & """ target=" & """_blank" & """><img border=" & """0" & """ alt=" & """Logo" & """ width=" & """110" & """ style=" & """width:110px; height:auto; border:0;" & """ src=" & strCompanyLogo & """></a>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "<td>"
CreateSigFile.Writeline "<table cellpadding="& """0"& """ cellspacing="& """0"& """>"
CreateSigFile.Writeline "<tbody>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 10pt; color:#0079ac; font-family: Arial, sans-serif; width: 305px; padding-bottom: 5px; padding-left: 10px; vertical-align: top; line-height:25px;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<strong><span style="& """font-size: 14pt; font-family: Arial, sans-serif; color:#008080;"& """>" & strFullName & "<br></span></strong>"
CreateSigFile.Writeline "<span style="& """font-family: Arial, sans-serif; font-size:10pt; color:#545454;"& """>" & strTitle & "</span>"
CreateSigFile.Writeline "<span style="& """font-family: Arial, sans-serif; font-size:10pt; color:#545454;"& """> | </span>"
CreateSigFile.Writeline "<span style="& """font-family: Arial, sans-serif; font-size:10pt; color:#545454;"& """>" & strCompany & "</span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 10pt; color:#444444; font-family: Arial, sans-serif; padding-bottom: 5px; padding-top: 5px; padding-left: 10px; vertical-align: top;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<span><span style="& """color: #008080;"& """><strong>m:</strong></span><span style="& """font-size: 10pt; font-family: Arial, sans-serif; color:#545454;"& """>" & strMobile & "<br></span></span>"
CreateSigFile.Writeline "<span><span style="& """color: #008080;"& """><strong>p:</strong></span><span style="& """font-size: 10pt; font-family: Arial, sans-serif; color:#545454;"& """>" & strOfficePhone & "<br></span></span>"
CreateSigFile.Writeline "<span><span style="& """color: #008080;"& """><strong>e:</strong></span><span style="& """font-size: 10pt; font-family: Arial, sans-serif; color:#545454;"& """>" & strEmail& "</span></span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 10pt; font-family: Arial, sans-serif; padding-bottom: 5px; padding-top: 5px; padding-left: 10px; vertical-align: top; color: #0079ac;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<span style="& """font-size: 10pt; font-family: Arial, sans-serif; color: #008080;"& """>" & strCompanyAddress1 & "<span><br></span></span>"
CreateSigFile.Writeline "<span style="& """font-size: 10pt; font-family: Arial, sans-serif; color: #008080;"& """>" & strCompanyAddress2 &"</span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 10pt; font-family: Arial, sans-serif; padding-bottom: 5px; padding-top: 5px; padding-left: 10px; vertical-align: top; color: #0079ac;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<a href="& """https://www.my-company.com"& """ target="& """_blank"& """ rel="& """noopener"& """ style="& """text-decoration:none;"& """><span style="& """font-size: 10pt; font-family: Arial, sans-serif; color: #008080;"& """>www.my-company.com</span></a>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 10pt; font-family: Arial, sans-serif; padding-bottom: 5px; padding-top: 5px; padding-left: 10px; vertical-align: top;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<span><a href="& strFacebook & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """21"& """ alt="& """facebook icon"& """ style="& """border:0; height:21px; width:21px"& """ src="& """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/fb.png"& """></a>&nbsp;</span><span><a href="& strTwitter & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """21"& """ alt="& """twitter icon"& """ style="& """border:0; height:21px; width:21px"& """ src="& """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/tt.png"& """></a>&nbsp;</span><span><a href="& strYouTube & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """21"& """ alt="& """youtube icon"& """ style="& """border:0; height:21px; width:21px"& """ src="& """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/yt.png"& """></a>&nbsp;</span><span><a href="& strLinkedIn & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """21"& """ alt="& """linkedin icon"&
""" style="& """border:0; height:21px; width:21px"& """ src="& """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/ln.png"& """></a>&nbsp;</span><span><a href="& strInstagram & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """21"& """ alt="& """instagram icon"& """ style="& """border:0; height:21px; width:21px"& """ src="& """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/it.png"& """></a>&nbsp;</span><span><a href="& strPinterest & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """21"& """ alt="& """pinterest icon"& """ style="& """border:0; height:21px; width:21px"& """ src="& """https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/simplephoto-with-logo/pt.png"& """></a></span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Close

'Applying the signature in Outlook’s settings.
Set objWord = CreateObject("Word.Application")
Set objSignatureObjects = objWord.EmailOptions.EmailSignature

'Setting the signature as default for new messages.
objSignatureObjects.NewMessageSignature = strUserName & "1"

'Setting the signature as default for replies & forwards.
objSignatureObjects.ReplyMessageSignature = strUserName & "1"
objWord.Quit

Script 2

The script below lets you create the following signature template:

Script 2 sample HTML email signature template
Click to expand/hide Script 2
On Error Resume Next

'Setting up the script to work with the file system.
Set WshShell = WScript.CreateObject("WScript.Shell")
Set FileSysObj = CreateObject("Scripting.FileSystemObject")
Set objSysInfo = CreateObject("ADSystemInfo")
Set UserObj = GetObject("LDAP://" & objSysInfo.UserName)
strAppData = WshShell.ExpandEnvironmentStrings("%APPDATA%")
SigFolder = StrAppData & "\Microsoft\Signatures\"
SigFile = SigFolder & UserObj.sAMAccountName & "2" & ".htm"

'Setting placeholders for the signature. They will be automatically replaced with data from Active Directory.
strUserName = UserObj.sAMAccountName
strFullName = UserObj.displayname
strTitle = UserObj.title
strMobile = UserObj.mobile
strEmail = UserObj.mail
strCompany = UserObj.company
strOfficePhone = UserObj.telephoneNumber

'Setting global placeholders for the signature. Those values will be identical for all users - make sure to replace them with the right values!
strCompanyLogo = "https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/logo.png"
strBanner = "https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/banner.png"
strBannerLinkingTo = "https://www.codetwo.com/email-signatures/"
strCompanyAddress = "16 Freedom St, Deer Hill 58-500 Poland"
strWebsite = "www.my-company.com"
strFacebook = "https://www.facebook.com/"
strTwitter = "https://www.twitter.com/"
strYouTube = ""
strLinkedIn = "https://www.linkedin.com/"
strInstagram = "https://www.instagram.com/"
strPinterest = ""

'Creating HTM signature file for the user's profile.
Set CreateSigFile = FileSysObj.CreateTextFile (SigFile, True, True)

'Signature’s HTML code
CreateSigFile.WriteLine "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>"
CreateSigFile.WriteLine "<HTML><HEAD><TITLE>Email Signature</TITLE>"
CreateSigFile.WriteLine "<META content='text/html; charset=utf-8' http-equiv='Content-Type'>"
CreateSigFile.WriteLine "</HEAD>"
CreateSigFile.WriteLine "<BODY style='font-size: 10pt; font-family: Arial, sans-serif;'>"
CreateSigFile.WriteLine "<table width='480' style='font-size: 11pt; font-family: Arial, sans-serif;' cellpadding='0' cellspacing='0' border='0'>"
CreateSigFile.WriteLine "<tbody>"
CreateSigFile.WriteLine "<tr>"
CreateSigFile.WriteLine "<td width='160' style='font-size: 10pt; font-family: Arial, sans-serif; width: 160px; vertical-align: top;' valign='top'> <a href='https://www.my-company.com/' target='_blank'><img border='0' alt='Logo' width='125' style='width:125px; height:auto; border:0;' src='" & strCompanyLogo & "'></a>"
CreateSigFile.WriteLine "</td>"
CreateSigFile.WriteLine "<td valign='top' width='270' style='width:270px; vertical-align: top; line-height:11px; border-right:2px solid #29abe1'><table cellpadding='0' cellspacing='0' border='0' width='270'><tbody> <tr> <td style='font-size:12pt; height:14px; line-height:14px'><strong style='font-family: Arial, sans-serif;font-size: 12pt;color:#29abe1;'>" & strFullName & "</strong></td> </tr> <tr> <td style='font-size:9pt; height:14px; line-height:14px'> <span style='font-family: Arial, sans-serif; font-size:9pt; color:#000000;'>" & strTitle & "</span> <span style='font-family: Arial, sans-serif; font-size:9pt; color:#000000;'> |" & strCompany & "</span> </td> </tr> <tr> <td style='height:14px; line-height:14px'>&nbsp;</td> </tr> <tr> <td style='font-size:9pt; height:14px; line-height:14px'> <span style='font-family: Arial, sans-serif;color:#000000;FONT-SIZE: 9pt'><strong>M</strong> " & strMobile & "</span> <span style='font-family: Arial, sans-serif;color:#000000;FONT-SIZE: 9pt'> | <strong>P</strong> " & strOfficePhone & "</span> </td> </tr> <tr> <td style='font-size:9pt; height:12px; line-height:12px'> <span style='font-family: Arial, sans-serif;color:#000000;FONT-SIZE: 9pt'><strong>E</strong> " & strEmail & "</span> </td> </tr> <tr> <td style='height:14px; line-height:14px'>&nbsp;</td> </tr> <tr> <td style='font-size:9pt; height:12px; line-height:12px'> <span style='font-family: Arial, sans-serif;color:#000000;FONT-SIZE: 9pt'>" & strCompanyAddress & "</span> </td> </tr> <tr> <td style='font-size:9pt; height:12px; line-height:12px'> <span><a href='https://" & strWebsite & "' target='_blank' rel='noopener' style=' text-decoration:none;'><strong style='color:#29abe1; font-family:Arial, sans-serif; font-size:9pt'>" & strWebsite & "</strong></a></span> </td> </tr> </tbody><tbody> </tbody></table>"
CreateSigFile.WriteLine "</td>"
CreateSigFile.WriteLine "<td style='vertical-align: top; padding-left:10px' valign='top' width='35'> <table cellpadding='0' cellspacing='0' border='0' width='25'> <tbody>"
If strFacebook <> "" Then
CreateSigFile.WriteLine "<tr> <td width='25' height='30' valign='top' style='vertical-align: top;'><a href='" & strFacebook & "' target='_blank' rel='noopener'><img border='0' width='26' height='25' alt='facebook icon' style='border:0; height:25px; width:26px;' src='https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/fb.png'></a></td></tr>"
End If
If strTwitter <> "" Then
CreateSigFile.WriteLine "<tr> <td width='25' height='30' valign='top' style='vertical-align: top;'><a href='" & strTwitter & "' target='_blank' rel='noopener'><img border='0' width='26' height='25' alt='twitter icon' style='border:0; height:25px; width:26px;' src='https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/tt.png'></a></td></tr>"
End If
If strYouTube <> "" Then
CreateSigFile.WriteLine "<tr> <td width='25' height='30' valign='top' style='vertical-align: top;'><a href='"& strYouTube &"' target='_blank' rel='noopene
r'><img border='0' width='26' height='25' alt='youtube icon' style='border:0; height:25px; width:26px' src='https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/yt.png'></a></td> </tr>"
End If
CreateSigFile.WriteLine "</tbody></table>"
CreateSigFile.WriteLine "</td>"
CreateSigFile.WriteLine "<td style='vertical-align: top;' valign='top' width='25'>"
CreateSigFile.WriteLine "<table cellpadding='0' cellspacing='0' border='0' width='25'> <tbody>"
If strLinkedIn <> "" Then
CreateSigFile.WriteLine "<tr><td style='height:12px; font-size:1px' height='12'>&nbsp;</td></tr> <tr> <td width='25' height='30' valign='top' style='vertical-align: top;'><a href='" & strLinkedIn & "' target='_blank' rel='noopener'><img border='0' width='26' height='25' alt='linkedin icon' style='border:0; height:25px; width:26px;' src='https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/ln.png'></a></td> </tr>"
End If
If strInstagram <> "" Then
CreateSigFile.WriteLine "<tr> <td width='25' height='30' valign='top' style='vertical-align: top;'><a href='" & strInstagram & "' target='_blank' rel='noopener'><img border='0' width='26' height='25' alt='instagram icon' style='border:0; height:25px; width:26px;' src='https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/it.png'></a></td> </tr>"
End If
If strPinterest <> "" Then
CreateSigFile.WriteLine "<tr> <td width='25' height='30' valign='top' style='vertical-align: top;'><a href='" & strPinterest & "' target='_blank' rel='noopener'><img border='0' width='26' height='25' alt='pinterest icon' style='border:0; height:25px; width:26px' src='https://codetwocdn.azureedge.net/images/mail-signatures/generator-dm/hexagonal-logo/pt.png'></a></td> </tr>"
End If
CreateSigFile.WriteLine "</tbody></table>"
CreateSigFile.WriteLine "</td>"
CreateSigFile.WriteLine "</tr>"
CreateSigFile.WriteLine "<tr><td colspan='4' style='padding-top:15px;'> <a href='" & strBannerLinkingTo & "' target='_blank' rel='noopener'><img border='0' alt='Banner' width='479' style='max-width:479px; height:auto; border:0;' src='" & strBanner & "'></a> </td>"
CreateSigFile.WriteLine "</tr>"
CreateSigFile.WriteLine "<tr><td colspan='4' style='padding-top:15px; line-height:14px; font-size: 7.5pt; color: #808080; font-family: Arial, sans-serif;'>The content of this email is confidential and intended for the recipient specified in message only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.</td>"
CreateSigFil
CreateSigFile.WriteLine "</tbody>"
CreateSigFile.WriteLine "</table>"
CreateSigFile.WriteLine "</BODY>"
CreateSigFile.WriteLine "</HTML>"
CreateSigFile.Close
Set objWord = CreateObject("Word.Application")
Set objSignatureObjects = objWord.EmailOptions.EmailSignature
objSignatureObjects.NewMessageSignature = strUserName & "2"
objSignatureObjects.ReplyMessageSignature = strUserName & "2"
objWord.Quit

Creating your own script

You can feed any HTML signature to the VBScript. For good examples of HTML signature templates, go to the free email signature generator or the free signature template library.

The general idea for creating your own script with the help of the sample scripts provided in the previous section of this article is to replace the code under the ‘Signature’s HTML code comment with your own. Keep in mind to replace user-specific data with placeholders, for example, use strFullName in place of the user’s name.

If you use the free email signature generator, you can get rid of the global placeholders found in the script above. Simply provide your company’s data as well as all the necessary links and graphics in the generator instead of replacing them with global placeholders in HTML code.

Deploying the script for a single user

Before you run the script for everyone in your company, it’s best to test it for a single user. To deploy the script, whether it’s your custom one or one of the samples provided above, follow these few simple steps:

  1. Copy & paste the VBScript code into any basic text editor (for example Notepad or Notepad++).
  2. Replace values for global placeholders (if applicable).
  3. Save the file with a .vbs extension.
  4. Run the script by double-clicking the VBS file.
  5. Finally, go to Outlook > File > Options > Mail > Signatures and confirm whether a signature with the same name as your AD account name has been added to the list of available signatures.

Now, when you get to the signature settings, you might see that the graphics are flattened, like that:

flattened email signature in Outlook editor

That’s because the Outlook’s signature editor doesn’t parse HTML code very well. The problem comes from the graphics’ height being set to “auto”. Fortunately, when the signature is added into an email, it’s parsed correctly.

hexagonal signature in Outlook's standard mode
hexagonal signature in Outlook's dark mode

Deploying the script for multiple users

There are two simple ways to deploy the script for multiple users. One of them is to launch the VBS file from each workstation, the second is to use GPO and a logon script. Since the first method is self-explanatory, I will show how to deploy the signature using GPO.

  1. Use the Windows logo key+R key combination to launch the Run console. Type gpmc.msc and press Enter to launch the Group Policy Management Editor.
Launch GPMC
  1. In the Editor, go to User Configuration > Policies > Windows Settings > Scripts. Right-click Logon and click Properties from the context menu.
Edit logon script
  1. In the Logon Properties window, click Add.
Add logon script
  1. In the window that opens, click Browse.
Edit logon script 2
  1. Locate your VBS file, highlight it, and add it to the logon script by clicking Open.
locate VBS file
  1. Finally, confirm by clicking Apply and OK.
Logon properties Apply

The next time a user logs in, the signature script should run, and the email signature should be added to that user’s Outlook profile.

Professional email signature management

VBScript, together with GPO, lets you manage email signatures across company. Thanks to this method, you can successfully deploy unified email signatures for every Outlook user in your organization. However nice it is, the method isn’t perfect. Here are just some of its drawbacks:

  • requires at least basic scripting knowledge,
  • doesn’t work with any email client other than desktop Outlook for Windows,
  • doesn’t prevent users from changing the signature,
  • updates take time (you need to change the script and to redistribute it),
  • it’s impossible to delegate this task to a marketing team,

That’s why we came up with tools for email signature management. The CodeTwo Exchange Rules family of products (for Exchange Server versions from 2007 to 2019) and CodeTwo Email Signatures for Office 365 (for Microsoft 365 organizations) take email signature management to a whole different level. These tools let you:

  • Design email signatures using a simple WYSIWYG editor or import any HTML code easily.
  • Add email signatures to emails send from any email client or device (including mobiles).
  • Add different email signature templates for different scenarios (depending on the recipient, different signature for first and subsequent emails in a conversation thread).
  • Prevent users from making any changes to the signature or disclaimer.
  • Implement changes to signatures instantly (changing images).
  • Embed images, so that they are always visible for your recipients (without the need to click “Download pictures”).
  • Schedule marketing campaigns.
  • And benefit from many more features…

Try CodeTwo Email Signatures for Office 365 for free – if you have a Microsoft 365 organization.

Try CodeTwo Exchange Rules for free – if you are running an on-premises Exchange Server.

CodeTwo Products

12 thoughts on “VBScript: create an HTML Outlook email signature for the whole company


  1. Hello Again,

    So I got this thing chugging thoroughly but I am running into a problem and wanted to see if you had any ideas on how to Embed The image Permanently or something when creating the Signature.

    When linking to object on my NAS Drives, The signature only populates in office or on the VPN, otherwise it shows the missing picture symbol. If I link it to OneDrive, it populates in the email, but as soon as I hit send they disappear.

    Any ideas on how to permanently embed it when creating the signature, or do I just add the extra step of a script that auto copies the files to a Their Base C: Drive and link that way?

    Thanks again for your hard work on this script! This saved me hours!

    • Hi,
      Glad I could be of help!
      You could use pretty much any image hosting service, as long as you use a direct image URL. Here is a guide on direct links.
      I guess adding images to the target signature folder would work, but I have never tested it. I’ll try to give it a go as soon as I get a chance.

  2. Thank you for replying. I found that in my code I assigned a variable
    SigFilename="DefaultSignature.htm"
    and later
    objSignatureObjects.NewMessageSignature = SigFilename
    The object.property cannot have an extension and only needs the filename.

    The new problem is that this code via logon script does not work if the user has more than one profile. When running outside of the logon process it pops up the profile selection box and the user clicks ok but it does not complete the process. The file exists in the correct directory but the final step of adding the default will not populate.

    Does a multiple profile setup require additional programming to identify the profile parameters?

    • I’m afraid that with multiple Outlook profiles, it becomes too compliacted to handle effectively with VBScript. Feel free to experiment, though.

  3. I have implemented this. It creates the file in the correct spot and is available for selecting it in Outlook but it doesn’t populate the filename in the default signatures as expected. If I cannot get it to work properly from my session I don’t think it will work when pushing it out with a logon script.
    I chose this model because all other similar scripts seem to do more with registry entries and impersonation to access the profile which I would like to avoid. Can you tell me if there are limitations?

    • As long as you make sure that the name of the created HTML signature file (SigFile = SigFolder & UserObj.sAMAccountName & “1.htm”)
      Is the same as in the assignment part: (objSignatureObjects.NewMessageSignature = strUserName & “1”)
      Everything should work all right. Keep in mind that in those scripts, the signature is named, for example, j.doe1 for the first script.

  4. Hi, these are so bloody useful, thanks! I’m using script 1 and it’s formatting beautifully, however it doesn’t appear to be setting as the default for New or Reply messages. Am I missing something?

    • The objSignatureObjects.NewMessageSignature = strUserName & "1" code is responsible for that. It seems I’ve left the & “1” part from testing, so the name of the signature is, for example, j.doe but the script tries to set j.doe1 as the default signature.
      I’ve fixed it – now the name of the signature includes “1” as well.

  5. Question for you! I got the script working well and modified it for my companies needs, so thank you so much!!

    How would I go about getting it to save as RTF and a TXT file as well? no that it matters all that much, but When we create it inside the outlook editor it saves it as those file types as well.

    I appreciate your time making this and saving me the heartache!

    Best,
    Rob

    • If I remember correctly, the RTF and TXT files are generated automatically, whenever a user opens the signature within the signature editor. Not sure if it’s that important to have all the formats, since the signature can be automatically converted to plain-text format, even without the dedicated version. And I don’t remember the last time I’ve received an email in the RTF format.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

*