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

Sending emails via Outlook in my Access DB. Does Outlook have to open?

Status
Not open for further replies.

jimtmelb1

Technical User
Sep 7, 2003
72
AU
Hi,

I have used code below to add a form that can send emails via my Access 2000 database.

I have a couple questions. I used the code and the email would only send if i had MS Outlook open. Can it send if the user doesn't have MS Outlook open? It looks like it has been sent while Outlook is closed but it only sends when you open Outlook later.

Also I get a message that says "A program is trying to send an email on your behalf......." You have to click yes to accept to send the email. Is there anyway to bypass or remove this message. Can the user get rid of this display either in properties or can i get rid of it in code.

Thanks.

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg

Set objOutlookRecip = .Recipients.Add("#email addresses go here separated by ;#")

' .CC = "#cc address - optional#"

' .Subject = "#subject line#"

' .Body = "#main message goes here#"

Set objOutlookAttach = .Attachments.Add(AttachmentPath)

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If editmessage Then
.Display
Else
.Save
.Send
End If

End With
Set objOutlook = Nothing
 
i had that same issue and that message is caused by the microsoft security patch for outlook. the message cannot be stopped the only way around it to remove that patch.
 
If its outlook XP, there is no way to get around it. However, Outlook express can be set so that the security message doesn't show up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top