HTML 签名脚本问题

问题描述 投票:0回答:1

我正在尝试创建一个签名脚本来在整个公司创建 HTML 签名。该脚本的一切似乎都有效,它完全按照营销所需的方式创建了签名。但是,当我向任何人发送电子邮件时,徽标不会出现在他们的末端。我的脚本非常有限,所以我不知道如何解决这个问题。我见过一些附加图像并使用“CID”将其输入的内容,但我不知道如何在我的脚本中使用它。下面是我的脚本(出于隐私原因进行了一些修改),任何人都可以帮我写这个以便徽标可以工作吗?我一定欠你一杯啤酒!

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 = "file_location\image.jpg"
strCompanyAddress1 = "Address"
strWebsite = """URL"
strFacebook = """url"
strTwitter = """url"
strYouTube = """url"
strLinkedIn = """url"
strInstagram = """url"
strPinterest = """url"

'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: 640px; 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: .5px solid; border-right-color: #404040; width: 115px; padding-right: 5px; vertical-align: middle;" & """ valign=" & """middle" & """ rowspan=" & """6" & """> <a href=" & strWebsite & """ target=" & """_blank" & """><img border=" & """0" & """ alt=" & """Logo" & """ width=" & """96" & """ style=" & """width:96px; height:97px; 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:#404040; font-family: Arial, sans-serif; width: 305px; padding-bottom: 15px; padding-left: 20px; vertical-align: top; line-height:25px;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<strong><span style="& """font-size: 14pt; font-family: Livory Bold, sans-serif; color:#404040;"& """>" & strFullName & "<br></span></strong>"
CreateSigFile.Writeline "<span style="& """font-family: Livory Regular, sans-serif; font-size:12pt; font-style: italic; color:#404040;"& """>" & strTitle & "</span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 12pt; color:#404040; font-family: Livory Bold, sans-serif; padding-bottom: 0px; padding-top: 5px; padding-left: 20px; vertical-align: top;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<span><span style="& """color: #404040;"& """><strong>email </strong></span><span style="& """font-size: 12pt; font-family: Livory Regular, sans-serif; color:#404040;"& """>" & strEmail & "<br></span></span>"
CreateSigFile.Writeline "<span><span style="& """color: #404040;"& """><strong>phone </strong></span><span style="& """font-family: Livory Regular, sans-serif; font-size:12pt; color:#4040404;"& """>" & strOfficePhone & "</span>"
If NOT (strMobile = "") Then 
    CreateSigFile.Writeline "<span style="& """font-family: Livory Bold, sans-serif; font-size:12pt; font-weight: bold; color:#404040;"& """> | mobile </span>"
    CreateSigFile.Writeline "<span style="& """font-family: Livory Regular, sans-serif; font-size:12pt; color:#404040;"& """>" & strMobile & "</span>"
End If
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 10pt; font-family: Arial, sans-serif; padding-bottom: 15px; padding-top: 0px; padding-left: 20px; vertical-align: top; color: #0079ac;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<span style="& """font-size: 12pt; font-family: Livory Regular, sans-serif; color: #404040;"& """>" & strCompanyAddress1 & "<span><br></span></span>"
CreateSigFile.Writeline "<span style="& """font-size: 12pt; font-family: Livory Regular, sans-serif; color: #404040;"& """>" & strCompanyAddress2 &"</span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
CreateSigFile.Writeline "<tr>"
CreateSigFile.Writeline "<td style="& """font-size: 12pt; font-family: Jabara, sans-serif; padding-bottom: 15px; padding-top: 5px; padding-left: 20px; vertical-align: top; color: #404040;"& """ valign="& """top"& """>"
CreateSigFile.Writeline "<a href="& "Website URL"& """ target="& """_blank"& """ rel="& """noopener"& """ style="& """text-decoration:none;"& """><span style="& """font-size: 12pt; font-family: Jabara, sans-serif; color: #404040;"& """>website url&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span>"& "<span><a href="& strFacebook & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """25"& """ margin-left="& """25"& """ alt="& """facebook icon"& """ style="& """border:0; height:25px; width:25px; margin-left:25px"& """ src="& """File Location\facebook.jpg"& """></a>&nbsp;</span><span><a href="& strLinkedIn & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """25"& """ alt="& """linkedin icon"&""" style="& """border:0; height:25px; width:25px"& """ src="& """File Location\linkedin.jpg"& """></a>&nbsp;</span><span><a href="& strInstagram & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """27"& """ alt="& """instagram icon"& """ style="& """border:0; height:27px; width:27px"& """ src="& """File Location\instagram.jpg"& """></a>&nbsp;</span><span><a href="& strPinterest & """ target="& """_blank"& """ rel="& """noopener"& """><img border="& """0"& """ width="& """25"& """ alt="& """pinterest icon"& """ style="& """border:0; height:25px; width:25px"& """ src="& """File Location\Pinterest.jpg"& """></a></span>"
CreateSigFile.Writeline "</td>"
CreateSigFile.Writeline "</tr>"
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
outlook scripting
1个回答
0
投票

查看带有图像的现有签名 - Outlook 将图像存储在“签名”文件夹的子文件夹中,并且

img
标记使用相对路径引用图像。插入签名时,Outlook 将图像添加为附件,并将 HTML 正文中的相对引用替换为根据内容 ID 引用附件的 cid 引用。

如果使用绝对路径引用图像,它们将不会被替换。

© www.soinside.com 2019 - 2024. All rights reserved.