gpt4 book ai didi

windows - 连接到 mapi 的 VB6 应用程序

转载 作者:可可西里 更新时间:2023-11-01 10:42:43 27 4
gpt4 key购买 nike

我创建了一个 VB6 应用程序,其中包含一个基本发送和接收电子邮件的服务,该服务使用在 Windows 2003 serverR2 中配置的服务帐户和 mapi 配置文件。

这在 exchange 服务器和域帐户都在同一网络中时有效。一旦交换服务器发生变化,该服务将无法发送或接收给出错误的电子邮件

Microsoft Exchange is not available. Either there are network problems or the Exchange computer is down for maintenance. [Microsoft Exchange Information Store - [MAPI_E_FAILONEPROVIDER(8004011D)]], Collaboration Data Objects.

我已经搜索了这个错误,但我无法收集到所有信息,因为解释是针对同一个网络的。任何人都可以请您建议我该怎么做才能解决这个问题?谢谢,

最佳答案

正如 @bob77 所建议的那样,Microsift 也已停止使用 MAPI。我建议使用 SMTP 或 EWS。

话虽如此,如果您仍然想继续使用它。请在下面找到工作代码:

   Set objMAPI = New MAPI.Session
objMAPI.Logon ShowDialog:=False, NewSession:=False, ProfileInfo:=gobjINI.gstrExchangeServer & vbLf & gobjINI.gstrProfile

'Add a new mesage to the OUtbo Messages Collection
Set objMSG = objMAPI.Outbox.Messages.Add

Set fsoMy_File_Sys_Obj = New FileSystemObject

'Add the recipient list specified in INI File
'Check if this is a multiple Recipient List (names or groups seperated by semicolons!)
If InStr(1, Recipients, ";") Then
objMSG.Recipients.AddMultiple Recipients, CdoTo
objMSG.Recipients.Resolve
Else
'This section is for handling of single recipient name
'Be aware that this may be an email group list name !
Set objRecipients = objMSG.Recipients.Add(Recipients)
objRecipients.Resolve
End If

'Add an attachment if needed
If Attachment_Name <> "" Then
bolAttach_File_Exists = fsoMy_File_Sys_Obj.FileExists(Attachment_Path)
If bolAttach_File_Exists = True Then
'Open the attachment file and add it to the message text
Set tsAttachment = fsoMy_File_Sys_Obj.OpenTextFile(Attachment_Path)
Do While Not tsAttachment.AtEndOfStream
strAttachment_Read = tsAttachment.ReadLine
Message = Message & strAttachment_Read & vbCrLf
Loop
tsAttachment.Close
Else
gobjMAPI.MailSend gobjINI.gstrMailRecipients, "Email Send - Attachment Addition", "Attempted To Attach A File That Does Not Exist", "", ""
End If
End If

'Add Subject Line, Message Content and Send Message
objMSG.Subject = Subject
objMSG.Text = Message
objMSG.Importance = mapiHigh

'The Update method adds all our assignments to collecttion
objMSG.Update

'Now let's actually send the message
objMSG.Send

'End MAPI Session
objMAPI.Logoff
Set objMAPI = Nothing

关于windows - 连接到 mapi 的 VB6 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42855608/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com