首页 > 解决方案 > 使用 Windows 应用程序发送邮件时出错

问题描述

在我的系统中,我使用的是 Windows 应用程序项目。当我从项目发送邮件时,我收到一个错误,因为“从 IClassFactory 创建具有 CLSID {20C62CA0-15DA-101B-B9A8-444553540000} 的 COM 组件实例失败,因为以下错误:80040112 类不是许可使用(来自 HRResult 的例外:0x800401120)。” . 你能帮我解决这个问题吗?我正在使用 Windows 10 操作系统。

Dim oMAPSession As New MSMAPI.MAPISession <br/>
Dim MAPIMessages As New MSMAPI.MAPIMessages

Do While J > 0
      With MAPIMessages
        oMAPSession.SignOn()
        .SessionID = oMAPSession.SessionID
        .Compose()

        If attachbio Then
            .AttachmentIndex = 0
            If CustomTable.GetCustomNumber("TEPrintPerUser") = 1 Then
                .AttachmentPathName = g_fpReportsPath & "\tempbio.pdf"
            Else
                .AttachmentPathName = Application.StartupPath & "\tempbio.pdf"
            End If
            .AttachmentName = "techbio.pdf"
        End If

        strRecip = Trim(rdtxtFldNumber.Text)
        i = 0
        Do
            .RecipIndex = i
            .RecipType = 1

            If InStr(1, strRecip, ";") > 0 Then
                .RecipDisplayName = Microsoft.VisualBasic.Left(strRecip, InStr(1, strRecip, ";") - 1)
                strRecip = Mid(strRecip, InStr(1, strRecip, ";") + 1)
                i = i + 1
            Else
                If (strRecip <> "") Then
                    .RecipDisplayName = strRecip
                End If
                Exit Do
            End If
        Loop
        GetDispatchForm = New FrmDispatch
        If g_sidCustomization = "Nebrasky" And GetDispatchForm.rdddlText.SelectedIndex = 1 Then
            .MsgSubject = Replace(rdtxtfpSubject.Text, Chr(10), " ")
        Else
            .MsgSubject = "Text Message " & Date.Now
        End If

        If tmpTextCapacity <= 0 Or (Not IsNumeric(Microsoft.VisualBasic.Left(.RecipDisplayName, InStr(1, .RecipDisplayName, "@") - 1))) Then
            .MsgNoteText = strText
            J = 0
        Else
            .MsgNoteText = Microsoft.VisualBasic.Left(strText, tmpTextCapacity)
        End If               
        .Send()                
    End With
    strText = Mid(strText, tmpTextCapacity + 1)
    J = J - tmpTextCapacity
Loop

在此处输入图像描述

标签: windowsvb.nettelerik

解决方案


推荐阅读