2011-06-08 69 views
2

我想设置一个脚本来使用交换帐户的电子邮件。我想用vbscript来使用CDO(或等价物)。目标是通过交换账户的发送文件夹来跟踪电子邮件通信。 我使用Exchange 2007的如何使用CDO与Exchange与vbscript

回答

3

使用Microsoft NTLM(http://msdn.microsoft.com/en-us/library/aa378749(v=vs.85).aspx) 在CDO这是一个CdoProtocolsAuthentication枚举(http://msdn.microsoft.com/en-us/library/ms526961(v=exchg.10).aspx

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 

Const cdoAnonymous = 0 'Do not authenticate 
Const cdoBasic = 1 'basic (clear-text) authentication 
Const cdoNTLM = 2 'NTLM 

dim objEmail 
    Set objEmail = CreateObject("CDO.Message") 
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")= cdoSendUsingPort 
'Name or IP of remote SMTP server 
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="exchange" 
'Server port 
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25 

objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpAuthenticate") = cdoNTLM 
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/NNTPAccountName") = "USERNAME" 
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/SaveSentItems") = TRUE 

objEmail.Configuration.Fields.Update 
objEmail.From = "FROM <[email protected]>" 
    objEmail.To = "[email protected]" 
    objEmail.Subject = "SUBJECT" 
    objEmail.Textbody = "BODY " 
    objEmail.Send 
+0

这是SMTP,不交流 – Wobbles 2017-09-26 19:13:20