I'm trying to send e-mail from our ERP system. I tried using SMTP but it only works for internal mail and fails for external mail complaining about unable to relay or something. I think the manager either doesn't want to or know how to configure Exchange properly.
So my boss told me to use Outlook. The problem is my code works fine in debug but fails if Outlook is open, which it will be in almost every case. I did get it to work my modifying the vendors installation, but we would prefer not to do that. We are using Intuitive ERP 8.5. It stores its library files in the standard folder and there is a custom folder for any custom code or inherited vendor objects.
Program Files\IntuitiveERP.exe Program Files\IntuitiveERP\Custom Program Files\IntuitiveERP\Standard
If I put the program directory on the root of C: and combine the standard and custom folders the code works whether Outlook is open or closed. We would prefer not to modify the vendor's installation because if may cause problems with updates.
'Fails with Cannot create ActiveX component.
objOutlook = CType(CreateObject("Outlook.Application"), Outlook.Application)
'Fails with Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.
objOutlook = New Outlook.Application
mobjEmail = CType(objOutlook.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
With mobjEmail
.CC = strEmployeeEmail
.Subject = String.Format(Constants.RFQ.Email.Subject, strRFQID)
.To = strTo
.Body = Constants.RFQ.Email.Body
.Attachments.Add(String.Format(Constants.RFQ.Output.FullPath, strRFQID))
.Display(True)
End With
Any idea how to get a reference to Outlook when its open? Any alternative solutions?