如何使用 VBScript 发送机密电子邮件

How to send a Confidential email using VBScript

我一直在网上搜索如何发送带有机密附件的电子邮件。我已经能够创建一个脚本来发送带有附件的电子邮件,但我不知道如何将其作为机密发送。

如果有人能帮助我如何在 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

你能试试这个吗?

不知道您是否有一些习惯headers。因此,请检查 Outlook 中的 headers,看看它们是否与我在下面发布的内容相匹配,但我相信这应该可以满足您的要求。

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