VB6 MSOUTL.OLB发送邮件

时间:2009-08-28 11:33:40

标签: vb6 outlook

我正在使用MSOUTL.OLB库发送邮件。

使用的代码如下:

Public Sub SendErrorLogToMailRecipients()
    Dim errorReportText As String

Dim fso As FileSystemObject
Set fso = New FileSystemObject
Dim txtStrm As TextStream

Set txtStrm = fso.OpenTextFile(frmMain.LogFileLocationFromRBT, ForReading, False, TristateTrue)
errorReportText = txtStrm.ReadAll
Call txtStrm.Close

If clsCom.IsStringEmpty(gstrErrorMailRecipients) Or clsCom.IsStringEmpty(errorReportText) Then
    Exit Sub
End If

Dim mItm As MailItem
On Error GoTo EH
Set mItm = outlApplication.CreateItem(olMailItem)
mItm.Save

With mItm
.To = gstrErrorMailRecipients
.Subject = "[[Express Claim Mail Process Error]]"
.Body = errorReportText
.BodyFormat = olFormatPlain
.Send
End With

Exit Sub
EH:
    Call frmMain.LogErrorAcrossUsingRBT("SendErrorLogToMailRecipients")
End Sub

我们发现我在Outlook中收到以下消息,导致我无法发送邮件:

程序正在尝试代表您自动发送电子邮件。 你想允许吗? 如果这是意料之外的,它可能是病毒,你应该选择“否”。

通过API访问邮箱时收到类似错误。我的解决方法是使用ClickYes。问题是我不想使用专业版。

感谢。

1 个答案:

答案 0 :(得分:1)

Outlook Redemption可能对您有用。