Access SendObject for Mass Mailing causes Outlook popup

G

Guest

I have a database for clients and have set up a form and code to run a query
for different types of clients and to send emails to the group.

Everything works fine until I try to send and then I get a Microsoft Outlook
pop-up which states:

"A program is trying to automatically 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."

This message stays for 5 seconds and then I can click on "YES" and it will
send the email, and start all over for the next recipient.

I am assuming this is an Outlook Spam Blocker, but is there any way to stop
it?

Thanks
 
R

Rick Brandt

JackBuff said:
I have a database for clients and have set up a form and code to run a query
for different types of clients and to send emails to the group.

Everything works fine until I try to send and then I get a Microsoft Outlook
pop-up which states:

"A program is trying to automatically 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."

This message stays for 5 seconds and then I can click on "YES" and it will
send the email, and start all over for the next recipient.

I am assuming this is an Outlook Spam Blocker, but is there any way to stop
it?

Only by not using Outlook. In a corporate environment using an Exchange server
the Exchange administrators can do things to get rid of it, but you cannot do so
on the client while still using Outlook to send the message. You can automate
the CDOSys library instead. That doesn't have a warning message.
 
G

Guest

Rick Brandt said:
Only by not using Outlook. In a corporate environment using an Exchange server
the Exchange administrators can do things to get rid of it, but you cannot do so
on the client while still using Outlook to send the message. You can automate
the CDOSys library instead. That doesn't have a warning message.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Thanks Rick, I will do some research on CDO to correct my problem.
 
G

Guest

As stated it can not be avoided using Access VBA SendObject.

You can though with using a Redemption.dll

see http://www.dimastr.com/redemption/

To install Redemption regsvr32.exe <fullpath>\redemption.dll

Redemption is a regular COM library and can be installed either with
regsvr32.exe or using your favorite installer (you will need to mark
redemption.dll as self-registering).

To use Redemption in VB or .Net languages, add "Redemption" library to your
project references.

Then sample code:

Set objSafeItem = CreateObject("Redemption.SafeMailItem")
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")

objNameSpace.Logon

' create the Message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
objSafeItem.Item = objOutlookMsg
With objSafeItem
.To = strTo
.Subject = strSubject
.Body = strBody
.Attachments.Add strAttachment1
'.Attachments.Add strAttachment2
'.Importance = 2 'High =2 low = 1
'.ReadReceiptRequested = True
'.Display
'.Save
.Send
End With
'
Set objOutlookMsg = Nothing
Set objNameSpace = Nothing
Set objOutlook = Nothing
Set objSafeItem = Nothing

Hope this help,
Jeff
 
G

Guest

Thanks Jeff. Will give it a try.


Jeff said:
As stated it can not be avoided using Access VBA SendObject.

You can though with using a Redemption.dll

see http://www.dimastr.com/redemption/

To install Redemption regsvr32.exe <fullpath>\redemption.dll

Redemption is a regular COM library and can be installed either with
regsvr32.exe or using your favorite installer (you will need to mark
redemption.dll as self-registering).

To use Redemption in VB or .Net languages, add "Redemption" library to your
project references.

Then sample code:

Set objSafeItem = CreateObject("Redemption.SafeMailItem")
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")

objNameSpace.Logon

' create the Message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
objSafeItem.Item = objOutlookMsg
With objSafeItem
.To = strTo
.Subject = strSubject
.Body = strBody
.Attachments.Add strAttachment1
'.Attachments.Add strAttachment2
'.Importance = 2 'High =2 low = 1
'.ReadReceiptRequested = True
'.Display
'.Save
.Send
End With
'
Set objOutlookMsg = Nothing
Set objNameSpace = Nothing
Set objOutlook = Nothing
Set objSafeItem = Nothing

Hope this help,
Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top