如何使用VBScript

时间:2016-06-07 00:59:51

标签: vbscript exchange-server cdo.message confidential

我一直在网上搜索如何发送附件保密的电子邮件。我已经能够创建一个脚本,以便能够发送带有附件的电子邮件,但我无法弄清楚如何将其作为机密发送。

如果有人可以帮助我如何在VBScript中设置电子邮件敏感度,我将不胜感激。

这是我的代码:

Call Email

sub Email

    Set objEmail = CreateObject("CDO.Message")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    objEmail.From = "myemail"
    objEmail.To = "SendToEmail"
    ObjEmail.Subject = "Email Title"
    ObjEmail.Textbody = "Email Body"
    objEmail.AddAttachment "C:\Temp\ERSD\dchmar_" & sDate & ".txt"
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="xx.xx.xx.xx"
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/exchange/sensitivity") = 3
    objEmail.Configuration.Fields.Update
    objEmail.Send

End sub

1 个答案:

答案 0 :(得分:0)

你可以尝试一下吗?

如果你有一些自定义标题,那就不知道了。因此请检查Outlook中的标题,看看它们是否与我在下面发布的内容相符,但我相信这应该可以完成您所要求的内容。

Set objEmail = CreateObject("CDO.Message")
Set objEmailConf = CreateObject("CDO.Configuration")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objEmail.From = "myemail"
objEmail.To = "SendToEmail"
ObjEmail.Subject = "Email Title"
ObjEmail.Textbody = "Email Body"
objEmail.AddAttachment "C:\Temp\ERSD\dchmar_" & sDate & ".txt"
objEmailConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmailConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="xx.xx.xx.xx"
objEmailConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'objEmailConf.Fields.Item("http://schemas.microsoft.com/exchange/sensitivity") = 3
objEmailConf.Fields.Update
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:Sensitivity") = "Company-Confidential"
objEmail.Configuration.Fields.Update
objEmail.Send