Sending an email without MAPI controls, security problem with Outlook
Posted on 2006-05-01
Running VB6 executable on several client machines. Using an email to generate a receipt of an event for the user that emails the user. I've been using this code a lot without any problems, until today.
An error occurred that stated something like "Email addresses are being accessed. Breach of security." My assumption is that the client machine has a security feature on her MS Outlook that is causing this. (No one else is getting this error).
My question is:
Does anyone know what that MS Outlook feature is and how she can disable it (she probably doesn't even know it's there)
Does anyone know how to work around it from code?
Sub SendAnEmailWithoutMAPI(strRecipient As String, strSubject As String, strText As String, strAttachment As String)
'This doesn't need any MAPI controls, just reference to Microsoft Outlook Library 9.0
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Set objMail = objOutlook.CreateItem(olMailItem)
'Where olMailItem is a built-in constant = 0 indicating the type of item to create
objMail.Subject = strSubject
objMail.body = strText
If strAttachment <> "" Then
'For this purpose, assume 1 file is attached
objMail.Attachments.Add strAttachment, olByValue, Len(strText) + 1, ExtractFileNameFromPath(strAttachment)
Set objMail = Nothing
Set objOutlook = Nothing