tags:

views:

128

answers:

1

I am using the MSOUTL.OLB library to send mails.

The code used is the following:

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

The issue us that I am receiving the following message in Outlook that is preventing me from sending the mail:

A program is trying to automaticly send e-mail on your behalf. Do you want to allow this? If this is unexpected, it may be a virus and you should choose "No".

I received a similar error when accessing the Mailbox through the API. My workaround was using ClickYes. The problem is that I don't want to use the Pro version.

Thanks.

+1  A: 

Outlook Redemption may be useful to you.

Remou