分享上個月依照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

先將安全的寄件者E-Mail名單,輸入在email.txt的文件中,內容如下:
jojo@test.com
chen@test.com
並將該檔案置於網路路徑\\NasA\ShareFolder內。

執行VBScript檔案,置於登入指令檔內。使用者電腦登入網域自動執行\\NasA\ShareFolder\email.txt複製到使用者的電腦C:\MIS資料夾中,並判斷使用者的Outlook版本,此例以Outlook 2003為主,自動匯入該檔案。若使用者已有此檔案則跳過程式不予執行。

arrow
arrow
    創作者介紹
    創作者 JojoChen 的頭像
    JojoChen

    JojoChen's MIS Blog

    JojoChen 發表在 痞客邦 留言(0) 人氣()