我有一个VB6应用程序通过Outlook通过MAPI发送电子邮件。它已经运作了十多年。
现在,在一台计算机上,第一封电子邮件将会发出,但除非程序重新启动,否则不会发送。
Outlook上是否有可能缓存第一个会话的设置?有没有办法在VB6中最终关闭Mapi会话,以便程序不必重新启动?
MAPISess.SignOn
MAPIMess.SessionID = MAPISess.SessionID
With MAPIMess
.Compose
.RecipDisplayName = cmbEmail.Text
.AddressResolveUI = True
For i = 0 To flxAttachments.Rows - 1
.AttachmentIndex = i
.AttachmentName = flxAttachments.TextMatrix(i, 0)
'"Invoice.htm"
.AttachmentPathName = flxAttachments.TextMatrix(i, 1)
'App.Path & "\Invoice.html"
.AttachmentType = 0
Next i
.ResolveName
.MsgSubject = txtSubject
.MsgNoteText = txtBody.Text
.Send
End With
Send_eMail = True
MAPISess.SignOff
Exit Function
ErrHandler:
MsgBox Err.Description
MAPISess.SignOff
Send_eMail = False
End Function