Mail from Access question

  • Thread starter Thread starter jer99
  • Start date Start date
J

jer99

I'm using Access 2000 and am using Outlook on a network.
The Application I created is going to be used by a number of folks.
In order to automate sending email with data from the application,
create an outlook application object.
Dim objOutlook As Outlook.Applicatio
Dim objOutlookMsg As Outlook.MailIte
Dim objOutlookRecip As Outlook.Recipien
Dim objOutlookAttach As Outlook.Attachmen
Then use .Sen

Problem is, a warning message comes up saying that someone is try t
access your email, do you wish to give them permission each time i
tries to send a message.

Any way around this either from the user or application
Is there a better way to send email form within an Access app

Jerr
 
I use CDO to send emails. The outlook client is not involved.

This is code from one of my applications, with the name of my smtp server
changed.

Public Sub SendMessage(strTo As String, strFrom As String, strCC As String,
strSubject As String, strBody As String)
Set imsg = CreateObject("cdo.message")
Set iconf = CreateObject("cdo.configuration")
Set Flds = iconf.Fields
With Flds
..Item("http://smtp.mydomain.com") = 2
..Item("http://smtp.mydomain.com") = "1.1.1.1"
..Update
End With

With imsg
Set .Configuration = iconf
.To = strTo
.From = strFrom
.CC = strCC
.Subject = strSubject
.TextBody = strBody
.Fields.Update
.Send
End With

Set imsg = Nothing
Set iconf = Nothing

End Sub
 
Someon ehad asked this before, and my code, although in 2002, never
asks. You might need to create a new Outlook Application:

Dim objOutlookApp As New Outlook.Application
Dim objOutlookMail As Outlook.MailItem
Dim objOutlookAttachments As Outlook.Attachments

Set objOutlookApp = CreateObject("Outlook.Application")
Set objOutlookMail = objOutlookApp.CreateItem(olMailItem)

With objOutlookMail
.To = strRecipients
.Subject = "Database Backup Report - " & Now
.Body = vbCrLf & vbCrLf & strLogInfo & vbCrLf & vbCrLf
.Send
End With
 
Back
Top