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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress Outlook Security Message

Status
Not open for further replies.

Knicks

Technical User
Apr 1, 2002
383
0
0
US
I was wondering if anyone has come across a simple technique for suppressing Outlook's automated security message when sending email through Access.

I am working in a large institution and do not have the ability to get the various security settings adjusted as it is a fairly beaurocratic environment. In saying that I also have end users with locked down computers, so utilizing something like "ClickYes" is probably not an option (though it works beautifully for me, I have admin priviledges on my pc).

I read some posts about CDO and MAPI, not totally sure I understand them - we use an Exchange Server and I assume with all the bells and whistles when it comes to security.

I am just looking for the easiest way to get past that "a program is trying to automatically send email on your behalf". The email being sent is very simple no attachments and to only 1 person.

From what I've read on the net, there are no simple answers except for ClickYes program - I would use it if the end user's PC wasn't locked down. I don't believe they will be able to install it.
 
Knicks -

Depending on how friendly your IT department is (and how feasible this is - I work for a small town and it is a viable option - may not be for a large corporation), you could try having Access output a .eml file that Exchange can automatically send.

You simply need to tell Access to output a *****.eml file that has a properly formatted header:

Code:
From: emailaddress@here.com
To: emailaddress@there.com
Subject: Subject Message Here

Output the file to the pickup folder on your Exchange server (if you have access), and you won't have to deal with any e-mail security warnings.
 
can you explain a little? Do I need to use CDO?

Right now I am basically using,

DoCmd.SendObject , "", "", StrEmail, "", "", "Complaint Received: " & StrClinic, strMessage, True, ""

The variable StrEmail looks up to a table of email addresses, StrClinic puts in the clinic in the Subject line. And StrMessage is a variable that holds the message. I am using "True" to hold the email so the user has to click on send (false triggers Outlook security).

So you are saying I have to save the whole thing as an EML file and put it in the outbox directory of outlook?
 
Hey Knicks:

Here's the code I used in my database:

Code:
Public Function Sendtxt() As String

'Original code by Jeremiah31 from Tek-Tips
'Modifications made by SBelyea from Tek-Tips

Dim I As Integer
Dim FileNum As Integer
Dim FileNameAndPath As String
Dim OutputLine As String
Dim Sender As String
Dim Recipient As String
Dim SubjectLine As String

FileNum = FreeFile()
FileNameAndPath = "P:\BMPText.eml"           'File output location and name (save as .eml)
Set DB = CurrentDb()                              'Use the current database
Set rs = DB.OpenRecordset("qry_sendemail")      'Open the recordset

'Exchange Header requires this format for output file (e-mail addresses are variable)
'From: exchange@place.com
'To: recipient@place.com
'Subject: Overdue BMP Inspections

'Exchange Header Information
Sender = "From: exchange@place.com"
Recipient = "To: " & rs.Email
Subject = "Subject: Overdue BMP Inspections"
Message = "The following businesses have overdue BMP inspections:"

If rs.EOF = False Then
rs.MoveFirst
Else
Set rs = Nothing
Set DB = Nothing
Exit Function
End If
'Open the file for output
Open FileNameAndPath For Output Access Write Lock Write As FileNum
I = 0
OutputLine = ""

'Output Exchange header information
Print #FileNum, Sender
Debug.Print Sender 'Debug.Print lines are optional, used for testing
Print #FileNum, Recipient
Debug.Print Recipient
Print #FileNum, Subject
Debug.Print Subject
Print #FileNum, OutputLine
Debug.Print OutputLine
Print #FileNum, Message
Debug.Print Message
Print #FileNum, OutputLine
Debug.Print OutputLine

'Start outputting the data
Do Until rs.EOF
For I = 0 To rs.Fields.Count - 1
    If I > 0 Then
        OutputLine = rs.OwnersBusiness(I).Value
    Else
        OutputLine = rs.Fields(I).Value
    End If
    Next I
    Print #FileNum, OutputLine
    Debug.Print OutputLine
    OutputLine = ""
    rs.MoveNext
    Loop
Close #FileNum
Set rs = Nothing
Set DB = Nothing
End Function

This code reports all of the OwnersBusiness from my qry_sendemail and drops it into a text file. You'll need to change the output location to your Exchange Pickup folder (which resides on the server on which Exchange runs). Ask your IT department (nicely!), and hopefully they can provide you with the permissions and filepath for it.

It's a pretty elegant solution, and eliminates any need for bypassing Outlook object security. The only caveat is that the recipient cannot reply to the sender.

My code is based mainly off of Jeremiah31's FAQ - you can reach it here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top