R
Richard
Hi
I have set up an automation with Outlook and sending emails to our clients.
I am using Redemption to avoid the security dialogs.
The problem is when it sends around 373 email, an error will occur and
emails stopped. I tried to open other forms but an error msg pops up citing
not enough memory. (Other programs works properly). When I close Access and
reopen it operates normally and when I send emails again, it will stop again
at 373-5 emails.
I tried sending very much smaller sized emails e.g "just hello". (50 bytes).
It still creates the error after 373 emails. What could be wrong and how do
I overcome this issue. Help is appreciated.
Thanks in advance
Richard
Here's the code:
Set ola = CreateObject("Outlook.Application")
Set myNameSpace = ola.GetNamespace("MAPI")
Set qryResults = CurrentDb.OpenRecordset("QryEmailWithoutEmailRet")
a = 1
If qryResults.BOF Then GoTo ExitHere
Me.lblStatus.Caption = "Creating emails. Please wait..."
DoEvents
Set myFolder = myNameSpace.GetDefaultFolder(olFolderDrafts)
Set myItem = myFolder.Items
qryResults.MoveFirst
Do Until qryResults.EOF
Set myTempItem = CreateObject("Redemption.SafeMailItem")
Set FWDItem = myItem.Item(1).Forward
FWDItem.To = qryResults!EMAIL
FWDItem.Display
FWDItem.Close olSave
DoEvents
FWDItem.DeleteAfterSubmit = True
myTempItem.Item = FWDItem
myTempItem.Send
Me.LblStatus2.Caption = a & " emails sent"
DoEvents
FWDItem.Close olDiscard
Set myTempItem = Nothing
Set FWDItem = Nothing
a = a + 1
qryResults.MoveNext
Loop
I have set up an automation with Outlook and sending emails to our clients.
I am using Redemption to avoid the security dialogs.
The problem is when it sends around 373 email, an error will occur and
emails stopped. I tried to open other forms but an error msg pops up citing
not enough memory. (Other programs works properly). When I close Access and
reopen it operates normally and when I send emails again, it will stop again
at 373-5 emails.
I tried sending very much smaller sized emails e.g "just hello". (50 bytes).
It still creates the error after 373 emails. What could be wrong and how do
I overcome this issue. Help is appreciated.
Thanks in advance
Richard
Here's the code:
Set ola = CreateObject("Outlook.Application")
Set myNameSpace = ola.GetNamespace("MAPI")
Set qryResults = CurrentDb.OpenRecordset("QryEmailWithoutEmailRet")
a = 1
If qryResults.BOF Then GoTo ExitHere
Me.lblStatus.Caption = "Creating emails. Please wait..."
DoEvents
Set myFolder = myNameSpace.GetDefaultFolder(olFolderDrafts)
Set myItem = myFolder.Items
qryResults.MoveFirst
Do Until qryResults.EOF
Set myTempItem = CreateObject("Redemption.SafeMailItem")
Set FWDItem = myItem.Item(1).Forward
FWDItem.To = qryResults!EMAIL
FWDItem.Display
FWDItem.Close olSave
DoEvents
FWDItem.DeleteAfterSubmit = True
myTempItem.Item = FWDItem
myTempItem.Send
Me.LblStatus2.Caption = a & " emails sent"
DoEvents
FWDItem.Close olDiscard
Set myTempItem = Nothing
Set FWDItem = Nothing
a = a + 1
qryResults.MoveNext
Loop