0
MSOUTL.OLBライブラリを使用してメールを送信しています。VB6 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です。問題は、私がProバージョンを使用したくないということです。
ありがとうございました。
ここをクリックしてください:http://stackoverflow.com/questions/1052636/how-can-i-avoid-outlooks-security-warning-when-sending-email-programmatically – MicSim
OLBはライブラリではなく、タイプ/インタフェース情報。あなたはOutlookを使用しています。 – Bob77