0
我已经实现了一个宏在Outlook电子邮件中的任何超链接之前追加一个字符串。然而,我把一个域名白名单工作正常,例如,如果我将https://google.com列入白名单,那么除了https://google.com/etc ..以及其后的任何内容,它都会将其列入白名单。白名单所有子域名VBA宏
我的问题是,如果有人想访问https://mail.google.com或任何其他子域,它将无法正常工作,并将其附加到APPEND_THIS_https://mail.google.com。我如何允许所有子域名在白名单中?
Dim myStr As String
Dim myURL As String
' Declare whitlist URL variables
'Dim whiteURL01 As String
'Dim whiteURL02 as string
myURL = "APPEND_THIS_"
' Add URLs to whitelist here
whiteURL01 = "https://google.com"
' Store the HTML Bodyin a variable
myStr = Msg.htmlbody
' Update all URLs
myStr = Replace(myStr, "href=""", "a href=" & myURL, , , vbTextCompare)
' Process whitelist
myStr = Replace(myStr, myURL & whiteURL01, whiteURL01, , , vbTextCompare)
' Assign back to HTML Body
Msg.htmlbody = myStr
' Save the mail
Msg.Save
太好了!!!正是我在找什么!它根据需要运行2件事。 1-如何阻止它附加邮件到链接2-我试过mailgoogle.com,它没有追加它。我希望它不会附加google.com或xxx.google.com,以免其他虚假域名不经过。再次感谢你! – user3454329
另外,它还附加了一个“之前的HREF例如APPEND_THIS_”http://...等 – user3454329
伟大的工作。为了您的第一条评论,只需将白名单中的域名更改为“.google.com”即可。 (之前添加点)。 – Fredrik