所以我試圖從Excel VBA後臺發送的自動消息。我非常擅長我的VBA技能,並且在過去使用了以下方法取得了巨大成功。我在我的新環境中使用這種方法時遇到了問題,並且我知道它與Exchange服務器的配置有關,問題是管理交換服務器的人員也不是我的Exchange專家。Exchange 2010的驗證問題
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大師可能會提供一些建議?
感謝, 乍得