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

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 clr
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import SendKeys
from System.Threading import *
from System.Runtime.InteropServices import Marshal
clr.AddReference("Microsoft.Office.Interop.Outlook")
import Microsoft.Office.Interop.Outlook as outlook

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

it=outlook.OlItemType.olMailItem
msg=out.CreateItem(it)

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

msg.Display(False)

SendKeys.SendWait("%(S)")
SendKeys.SendWait("%(S)")

Hope it mails :)

1 Comment

Hi Harmeet,

Your answer is helpful. Thanks. But is there any way we can give outlook credentials here to use instead of keeping outlook open?

Thanks,

Sunitha

sunitha1210 - Mar 10, 2017 - 11:22am ::
+ Add a Comment

(9) Answers

Login