Jump to content

Please find below the script to send outlook mails through spotfire, modify it according to your need.

Manoj Chaurasia

Recommended Posts

Hi All,


Please find below the script to send outlook mails through spotfire, modify it according to your need.


Please make sure outlook is opened.



import clrclr.AddReference("System.Windows.Forms")from System.Windows.Forms import SendKeysfrom System.Threading import *from System.Runtime.InteropServices import Marshalclr.AddReference("Microsoft.Office.Interop.Outlook")import Microsoft.Office.Interop.Outlook as outlook

out = Marshal.GetActiveObject("Outlook.Application")ns=out.GetNamespace("MAPI")df=outlook.OlDefaultFolders.olFolderOutboxf = ns.GetDefaultFolder(df);


ins=msg.GetInspectormsg.HTMLBody="hello spotfire training is on"msg.Subject="Spotfire"msg.To="harmeet.singh@gmail.com"





Hope it mails :)

Link to comment
Share on other sites

  • 3 weeks later...
  • 7 months later...
  • 1 year later...
  • 4 weeks later...

Hi Harmeet,

I have tried the above code sending mails through Outlook. Where as it is working fine in Client but not in WebPlayer. I am using Spotfire 7.6.1 Version

It throws the below error:

Could not add reference to assembly Microsoft.Office.Interop.Outlook

at IronPython.Runtime.ClrModule.AddReference(CodeContext context, String name)

at IronPython.Runtime.ClrModule.AddReference(CodeContext context, Object reference)

at IronPython.Runtime.ClrModule.AddReference(CodeContext context, Object[] references)

at _stub_$2622##2622(Closure , CallSite , CodeContext , Object , String )

at Microsoft.Scripting.Actions.MatchCaller.Call3[T0,T1,T2,TRet](Func`5 target, CallSite site, Object[] args)

at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)

at Microsoft.Scripting.Actions.UpdateDelegates.Update3[T,T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)

at $2629##2629(Closure , Scope , LanguageContext )

at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)

at Spotfire.Dxp.Application.ScriptSupport.IronPythonScriptEngine.Execute(ScriptDefinition script, Dictionary`2 scope)

at Spotfire.Dxp.Application.Scripting.ScriptService.Execute(ScriptDefinition script, Dictionary`2 scope, InternalLibraryManager internalLibraryManager, NotificationService notificationService)

at Spotfire.Dxp.Application.Scripting.ScriptManager.c__DisplayClass4.b__3()

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(Executor executor, Boolean visible, Boolean sticky, Guid stickyGuid)

at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor)

at Spotfire.Dxp.Application.Scripting.ManagedScript.Execute(Dictionary`2 environment)

at Spotfire.Dxp.Application.HtmlTextAreaControls.ActionControl.ModifyCore(Object value)

at Spotfire.Dxp.Application.Visuals.HtmlTextArea.InteractWithControl(String id, Action`1 interaction)


Could you please help me in this regard.

Link to comment
Share on other sites

  • 4 months later...
  • 7 months later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...