J
Jørgen
I'm trying to send an email from a .dll.
The problem is that when run within VB6 it works, but when compiled and put
on the server it fails in line: 017 stating that this is not allowed.
Please help....
001 Function sendContract(ByVal ContractNo As Long, _
002 ByVal mailTO As String, _
003 ByVal mailATTACH As String)
004
005 Dim objOutlook As Outlook.Application
006 Dim objOutlookMsg As Outlook.MailItem
007 Dim objOutlookRecip As Outlook.Recipient
008 Dim objOutlookAttach As Outlook.Attachments
009
010 Set objOutlook = CreateObject("Outlook.Application")
011 Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
012 Set objOutlookRecip = objOutlookMsg.Recipients.Add(mailTO)
013 objOutlookRecip.Type = olTo
014 objOutlookMsg.Subject = "Contrakt nr.:" & CStr(ContractNo)
015 objOutlookMsg.Importance = olImportanceHigh
016 objOutlookMsg.Save
017 Set objOutlookAttach = objOutlookMsg.Attachments
018 objOutlookAttach.Add mailATTACH, olByValue, 1, "Contrakt"
019 objOutlookMsg.Send
020
021 End Function
The problem is that when run within VB6 it works, but when compiled and put
on the server it fails in line: 017 stating that this is not allowed.
Please help....
001 Function sendContract(ByVal ContractNo As Long, _
002 ByVal mailTO As String, _
003 ByVal mailATTACH As String)
004
005 Dim objOutlook As Outlook.Application
006 Dim objOutlookMsg As Outlook.MailItem
007 Dim objOutlookRecip As Outlook.Recipient
008 Dim objOutlookAttach As Outlook.Attachments
009
010 Set objOutlook = CreateObject("Outlook.Application")
011 Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
012 Set objOutlookRecip = objOutlookMsg.Recipients.Add(mailTO)
013 objOutlookRecip.Type = olTo
014 objOutlookMsg.Subject = "Contrakt nr.:" & CStr(ContractNo)
015 objOutlookMsg.Importance = olImportanceHigh
016 objOutlookMsg.Save
017 Set objOutlookAttach = objOutlookMsg.Attachments
018 objOutlookAttach.Add mailATTACH, olByValue, 1, "Contrakt"
019 objOutlookMsg.Send
020
021 End Function