分享上個月依照H同事建議撰寫VBScript,只將Outlook 2003垃圾郵件撰項中,匯入安全的郵件寄件者,避免特定使用者的E-Mail被認定是垃圾郵件,造成使用者郵件遺漏。
撰寫測試時,其無法適用於Outlook 2013版本,經Google搜尋國外各論壇無此解決方法,特此告知。其VBScript語法如下:
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_CLASSES_ROOT = &H80000000
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Set Fso=CreateObject("Scripting.FileSystemObject")
If Fso.FileExists("C:\MIS\email.txt") Then
Wscript.Quit
Else
Fso.CopyFile "\\NasA\ShareFolder\email.txt", "C:\MIS\email.txt","True"
strKeyPath = "Outlook.Application\CurVer"
strValueName = ""
oReg.GetStringValue HKEY_CLASSES_ROOT , strKeyPath, strValueName, strValue
If Cint(Right(strValue,2))=11 Then
strKeyPath = "SOFTWARE\Microsoft\Office\11.0\Outlook\Options\Mail"
strKeyValue = "JunkMailImportLists"
oReg.CreateKey HKEY_CURRENT_USER,strKeyPath
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strKeyValue,1
strKeyPath1 = "SOFTWARE\Microsoft\Office\11.0\Outlook\Options\Mail"
strValueName1 = "JunkMailSafeSendersFile"
strValue1 = "C:\MIS\email.txt"
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath1,strValueName1,strValue1
Wscript.Echo "Outlook已成功匯入安全的寄件者"
Else
Wscript.Quit
End If
End If