Warning when trying to send email using sendObject (1 Viewer)

dealwi8me

Registered User.
Local time
Today, 19:12
Joined
Jan 5, 2005
Messages
187
I have the following function that runs through a macro:

Code:
Public Function sendEmailF1()

Dim strSQL As String
Dim rs As DAO.Recordset

strSQL = "SELECT * FROM tblContactClients "

Set rs = CurrentDb.OpenRecordset(strSQL)

While Not rs.EOF
If (DateAdd("d", 2, rs.Fields("InsDate")) = Date) Then
 DoCmd.SendObject _
     , _
     , _
     , rs.Fields("InsEmail"), _
     , _
     , _
     ("" & "Reminder"), _
     ("" & "Contact " & rs.Fields("InsName")), _
        False
End If
rs.MoveNext
Wend

rs.Close
Set rs = Nothing
End Function

What I need to do is sending an automated email and remind the users that they have to contact the clients if the date is correct.

I thought of scheduling the database to open at 07:00 am every day (the database is running on 24h open server), run an autoexec macro with the above code and then to close, but i have the following problem:
1. Everytime the sendObject command is trying to send an email I 'm getting a warning that a program is trying to send an email through outllook and wants acceptance from the user in order to proceed. Is it possible to disable the warning and send the emails immediately?

Thank you in advance :)
 

Moniker

VBA Pro
Local time
Today, 11:12
Joined
Dec 21, 2006
Messages
1,567
That's a security setting in Access and/or Outlook. You'll need to set it to Low Security (assuming all your users are trusted). The differences:

High Security: No macros/VBA will run. Don't do it.

Medium Security: You get warnings like what you're experiencing.

Low Security: You get no warnings. Safe users assumed.
 

dealwi8me

Registered User.
Local time
Today, 19:12
Joined
Jan 5, 2005
Messages
187
Thank you for your answer :)

This setting will act for all applications or just the particular?
Because i don't think is a good idea to set low security for all applications.

I also tried not to use outlook and send emails through CDO object. Is it possible to send emails to exchange server? Because when i tried CDO i only received the emails from POP3, not through exchange server.
 

Users who are viewing this thread

Top Bottom