Need to Override Outlook 2007's security


L

LA Lawyer

I am trying to use Access 2007 to send an email through Outlook 2007.
Everything works until Outlooks pops the security warning. How do get
Outlook to stop this?

Here is my code, which otherwise is fine:

Public Function SendEMail(Receipient As String, theSubject As String,
theBody As String, Optional CarbonCopy As String, Optional BlindCopy As
String)
Dim nsMAPI As Outlook.NameSpace
Dim objOutbox As Outlook.MAPIFolder
Dim objNewMessage As Outlook.MailItem
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If objOutlook Is Nothing Then
Set objOutlook = New Outlook.Application
End If
Set nsMAPI = objOutlook.GetNamespace("MAPI")
Set objOutbox = nsMAPI.GetDefaultFolder(olFolderOutbox)
Set objNewMessage = objOutbox.Items.Add
With objNewMessage
.To = Receipient
.Body = theBody
.Subject = theSubject
If Not IsNull(CarbonCopy) Then
.cc = CarbonCopy
End If
If Not IsNull(BlindCopy) Then
.BCC = BCC
End If
.Send
End With
End Function
 
Ad

Advertisements

M

Michael Bauer [MVP - Outlook]

You can either not call Send, but just Display the message and manually hit
the Send button, or use the Redemption (www.dimastr.com).

BTW: The IsNull function will always return False for a String variable.

--
Best regards
Michael Bauer - MVP Outlook
Category Manager - Manage and share your categories:
SAM - The Sending Account Manager:
<http://www.vboffice.net/product.html?lang=en>


Am Mon, 5 Apr 2010 18:28:02 -0700 schrieb LA Lawyer:
 

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