By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 2,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

How to avoid security pop-up when sending automatic email in Access 2002

P: 69
I've written (actually modified from another post) the following code to automatically send an email message from within Access.

Expand|Select|Wrap|Line Numbers
  1. Public Function SendEmail(TOstr As String, SUBJECTstr As String, BODYstr As String) As Boolean
  2. Dim OUTLOOKobj As Outlook.Application
  3. Dim EMAILobj As Outlook.MailItem
  4. Dim AB_RS As DAO.Recordset
  5.  
  6. On Error GoTo Err_SendEmail
  7.  
  8.     Set OUTLOOKobj = CreateObject("Outlook.application")
  9.     Set EMAILobj = OUTLOOKobj.CreateItem(olMailItem)
  10.     Set AB_RS = CurrentDb.OpenRecordset("SELECT RECIP_EMAIL FROM ADDRESS_BOOK WHERE RECIP_NAME = '" & TOstr & "'")
  11.  
  12.     With EMAILobj
  13.  
  14.         .To = AB_RS![RECIP_EMAIL]
  15.         .Subject = SUBJECTstr
  16.         .Body = BODYstr
  17.         .Send
  18.     End With
  19.  
  20.     Set EMAILobj = Nothing
  21.  
  22.     SendEmail = True
  23.  
  24. Exit_SendEmail:
  25.     Exit Function
  26.  
  27. Err_SendEmail:
  28.     MsgBox Err.Description, vbOKOnly, "Error #" & Err.Number
  29.     SendEmail = False
  30.     Resume Exit_SendEmail
  31.  
  32. End Function
Problem is, when the code executes a security pop-up is displayed asking the user to confirm sending the message:

"A program is trying to automatically send e-mail on your behalf.
Do you want to allow this?"

This pop-up takes the automatic out of "automatic email." How do I defeat this pop-up? Or will doing so make me a potential spammer? :) It seems like this would be a registry setting somewhere.

I found an identical post to this in one of the other forums from October, but no one replied to it.

Thanks in advance,
Scott
Nov 26 '07 #1
Share this Question
Share on Google+
3 Replies


Jim Doherty
Expert 100+
P: 897
I've written (actually modified from another post) the following code to automatically send an email message from within Access.

Expand|Select|Wrap|Line Numbers
  1. Public Function SendEmail(TOstr As String, SUBJECTstr As String, BODYstr As String) As Boolean
  2. Dim OUTLOOKobj As Outlook.Application
  3. Dim EMAILobj As Outlook.MailItem
  4. Dim AB_RS As DAO.Recordset
  5.  
  6. On Error GoTo Err_SendEmail
  7.  
  8. Set OUTLOOKobj = CreateObject("Outlook.application")
  9. Set EMAILobj = OUTLOOKobj.CreateItem(olMailItem)
  10. Set AB_RS = CurrentDb.OpenRecordset("SELECT RECIP_EMAIL FROM ADDRESS_BOOK WHERE RECIP_NAME = '" & TOstr & "'")
  11.  
  12. With EMAILobj
  13.  
  14. .To = AB_RS![RECIP_EMAIL]
  15. .Subject = SUBJECTstr
  16. .Body = BODYstr
  17. .Send
  18. End With
  19.  
  20. Set EMAILobj = Nothing
  21.  
  22. SendEmail = True
  23.  
  24. Exit_SendEmail:
  25. Exit Function
  26.  
  27. Err_SendEmail:
  28. MsgBox Err.Description, vbOKOnly, "Error #" & Err.Number
  29. SendEmail = False
  30. Resume Exit_SendEmail
  31.  
  32. End Function
Problem is, when the code executes a security pop-up is displayed asking the user to confirm sending the message:

"A program is trying to automatically send e-mail on your behalf.
Do you want to allow this?"

This pop-up takes the automatic out of "automatic email." How do I defeat this pop-up? Or will doing so make me a potential spammer? :) It seems like this would be a registry setting somewhere.

I found an identical post to this in one of the other forums from October, but no one replied to it.

Thanks in advance,
Scott

Scott,

Have a look at a previous thread I had on this to give you some ideas. in addition to others that are available ie using REDEMPTION with outlook (google that) or using a third party application

http://www.thescripts.com/forum/thre...s+library.html

Regards

Jim :)
Nov 27 '07 #2

P: 69
Scott,

Have a look at a previous thread I had on this to give you some ideas. in addition to others that are available ie using REDEMPTION with outlook (google that) or using a third party application

http://www.thescripts.com/forum/thre...s+library.html

Regards

Jim :)

Jim,

This is exactly what I was looking for! I've copied your code into my app and it runs perfectly. Thanks!

Gratefully,
Scott
Nov 27 '07 #3

Jim Doherty
Expert 100+
P: 897
Jim,

This is exactly what I was looking for! I've copied your code into my app and it runs perfectly. Thanks!

Gratefully,
Scott
You're welcome

Jim :)
Nov 27 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.