Send email from my app automation error
Posted on 2003-03-06
I have an app that allows users to select a file then send it using outlook. This is not an email client or anything it is a document browser but I want the user to be able to select a document click send and it create an email with the attachment. The code I am using is: -
Private Sub cmdSend_Click()
Public Sub SendFile(sFile as string)
dim appOutlook as application
dim mitItem as mailitem
dim attAttachment as attachement
dim sFileLocation as string
dim sBody as string
dim sSubject as string
dim sRecipient as string
sFileLocation = sFile
sSubject = "Document"
sBody = "Please find requested document attached"
set appOutlook = CreateObject("Outlook.Application")
set mitItem = appOutlook.CreateItem(olMailItem)
sRecipient = "RecipName@site.com"
.to = srecipient
.subject = sSubject
.body = sBody
Set mitItem = Nothing
Set appOutlook = nothing
This all works fine when I test it using using my laptop but when using the company network I get the following error messages: -
Automation Error - when I click ok to this I then get
Dr Watson exception errors.
The OS on the network computer I am testing this on is NT, with outlook 97. I think that the problem may be something to do with security, but surely there must be a way to send a mail item without breaching the security. If I try this on a computer running Windows 98 I get the error: -
ActiveX component can't create object.
The points I am awrding for this question are for whoever can provide me with a workaround or method to provide the users with the ability to send an email direct from within my application.