Exchange 2010身份验证问题



所以我正试图从Excel VBA后端发送一条自动消息。我在VBA技能方面非常胜任,并且在过去使用过以下方法并取得了巨大成功。我在新环境中使用这种方法时遇到了问题,我知道这与Exchange服务器的配置有关,问题是管理Exchange服务器的人和我都不是Exchange专家。

Public Function SendEmail(
txtTo As String, 
txtSubject As String, 
txtBody As String,    
Optional txtSender As String = vbNullString, 
Optional txtCC As String = vbNullString, 
Optional txtBCC As String = vbNullString)
Dim objMsg As Object, objconfig As Object, objFields As Object
Set objMsg = CreateObject("CDO.Message")
Set objconfig = CreateObject("CDO.Configuration")
Set objFields = objconfig.fields
'Set the email configuration
With objFields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
'Apply the various fields to the email object
With objMsg
.Configuration = objconfig
.From = txtSender
.Subject = txtSubject
.To = txtTo
.Cc = txtCC
.Bcc = txtBCC
.TextBody = txtBody         
.Send
End With
SendEmail = IIf(Err.Number = 0, True, False)
'clean up
Set objMsg = Nothing
Set objconfig = Nothing
Set objFields = Nothing
End Function

我正试图发送到需要身份验证的通讯组。我们已经想好了如何删除发送电子邮件的"功能",但这并不理想。我已经尝试使用基本/清除信任(1)作为身份验证方法,将我的用户名和密码提供给配置对象中所需的字段,但仍然没有骰子。当我从Outlook发送电子邮件时,发送到需要身份验证的电子邮件没有问题,但使用CDO Exchange时不允许我进行身份验证。它也从不解析发件人地址,不确定这是否相关,但为了充分披露,它确实存在。我知道Exchange/SMTP服务器被配置为允许匿名发送,但这似乎是CDO将使用的唯一选项。

我无计可施。有没有Exchange专家可以提供一些建议?

谢谢,乍得

好吧,我终于解决了自己的问题。如果其他人也有类似的问题,我想我会分享。结果是一个港口问题。

交换的标准端口是SSL的25和465(我相信)。

在这种情况下,端口25被配置为从我们的防火墙后面匿名发送(主要通过打印机和传真机)。我尝试使用端口465,但它报告说该端口不存在。

在exchange服务器上进行了大量挖掘后,我发现一些任意的端口号被用来配置经过身份验证的消息。一旦我在上面的代码中硬编码了正确的端口号,我就可以让它正常工作了。编码快乐!

最新更新