I have a web page from which I need to send an email to. I need to send a LARGE email from the browser. Because the content is larger than the query string allows, I need to rely on Active X. I want to send this email through Outlook. In an attempt to do this, I've written the following code:
try {
var to = "";
var cc = "";
var subject = "Action Required";
var body = GenerateEmailBody();
var outlook = new ActiveXObject('Outlook.Application');
var outlookNamespace = outlook.GetNameSpace('MAPI');
var message = outlookNamespace.CreateItem(0);
message.Display();
message.To = to;
message.Subject = subject;
message.Body = body;
message.GetInspector.WindowState = 2;
} catch (err) {
alert("Unable to send email. " + err);
}
When I execute this code, I get the following error:
ReferenceError: ActiveXObject is not defined
What am I doing wrong?
Thanks!
You might encounter the problem that automation server can't create object on Windows 10 because your browser's Internet security settings are too strict, especially after installing an add-on. To solve the problem, you need to change security settings, and then clear the browsing history.
This behavior can occur if any of the following conditions are true: Data Access Objects (DAO) is not properly registered. One or more references are missing. There is a utility database reference that is not valid.
ActiveX Automation, formerly known as OLE (Object Linking and Embedding) Automation, allows you to manipulate programmable objects from internal environments such as Visual Basic for Applications (VBA) or external environments such as Microsoft® Visual Basic and other applications that incorporate VBA.
The error "Automation Server Can't Create Object" means that your browser's security settings are too low for the ActiveX control to run. You have to move your page into the trusted sites list and lower the ActiveX settings so it can run.
Personally I would avoid ActiveX like the plague since it is locking you into the IE only world. Hence why we still have people stuck with IE6.
It you are trying to just preload a mail message, you can use mailto:
a) Go to Tools-->Internet Options
b) Select security tab
c) Click on Trusted Sites (or Local Intranet depending on whether your site is trusted or not)
d) Click on Custom Level
e) Ensure that "Initialize and script active x controls is not marked safe for scripting" is enabled - this comes under Activex controls and plug-ins section towards 1/4th of the scroll bar.
Click OK, OK.
Once this is completed, clear the browser cookies and cache. Close all your browser sessions. Reopen the IE to launch your site.
Try to disable the setting in step (e) to see if the problem comes back - that should give more insight to the problem.
Source : IE9, Automation server can't create object error while using CertEnroll.dll
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With