Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple MAPI security patch

Status
Not open for further replies.

SteveMac32

Programmer
Jan 25, 2002
74
GB
Hi list,
Some time ago I developed a basic email program that would "integrate with Outlook" using simple MAPI and VB, now when I run it (win2000 sp2, Office 2000) I keep getting the security boxes/messages:

"A program is trying to automatically send email on your behalf............"

and then another security box/messages:
"A program is trying to send email......"

This as you can guess is really annoying especially when you want to send a lot of emails, is there a work around or are we stuck with it.

Any ideas would be grateful received.

Thanks

Steve Mac
 
It depends on how you accessed Outlook. If you use CDO (Collabrative Data Objects) then this should avert the problem.

Here is a samll example of CDO

Public Function IsUserOnline(ByRef LoginName As string, RyRef EmailSubject as String, RyRef EmailText as String) As Boolean
On Error GoTo ErrorHandler
Dim objSession As MAPI.Session
Dim objInfoStore
Dim objOutbox As Folder
Dim objNewMessage As Message
Dim objRecipients As Recipients
Dim objOneRecip As Recipient

If Not IsNull(objSession) Then
Set objSession = CreateObject("mapi.session")
objSession.Logon LoginName, "", False, False, 0
End If

If objSession.CurrentUser <> LoginName Then
isuseronlne = True
Exit Function
End If

Set objInfoStore = objSession.InfoStores(&quot;Public Folders&quot;)
On Error Resume Next
IsUserOnline = objInfoStore.Fields(PR_STORE_OFFLINE).Value
If Err.Number <> 0 Or IsUserOnline <> 0 Then
'The PR_STORE_OFFLINE field may not exist,
'which indicates that the store is online.
IsUserOnline = False
End If


Set objOutbox = objSession.Outbox
Set objNewMessage = objOutbox.Messages.Add
Set objRecipients = objNewMessage.Recipients
Set objOneRecip = objRecipients.Add
With objOneRecip
.Name = LoginName
.Type = ActMsgTo
.Resolve showdialog = False
End With

With objNewMessage
.Subject = EmailSubject
.Text = EmailText
.Send
End With

Set objInfoStore = Nothing
Set objOutbox = Nothing
Set objNewMessage = Nothing
Set objRecipients = Nothing
Set objOneRecip = Nothing

Exit Function
ErrorHandler:
MsgBox &quot;EMAIL ERROR &quot; & err.Number & err.Description
End Function
Craig, mailto:sander@cogeco.ca
&quot;Procrastination is the art of keeping up with yesterday.&quot;
I hope my post was helpful!!!
 
Hi, sorry to tell you this, but ppl have asked about it before, it's the sercurity thing that only happens with the latest Outlook security Patch, I think, it never happens to me. And most ppl I asked say there's not much you can do except maybe only allow outgoing email and not install the security patch. Don't know how that's gonna work out. If anyone can confirm this, or even provide some solutions, that would be great.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top