How to to send an email via Outlook using IronPython in TIBCO Spotfire®

Last updated:
11:47pm Aug 26, 2019
Back to main IronPython scripting page

Introduction

This script will send an email via Outlook. Outlook must be running in order for this script to work.This script will not work on Web Player. This is only for Professional Client.

Code sample

# Copyright © 2017. TIBCO Software Inc.  Licensed under TIBCO BSD-style license.

import clr
clr.AddReference("Microsoft.Office.Interop.Outlook")
from System.Runtime.InteropServices import Marshal

mail= Marshal.GetActiveObject("Outlook.Application").CreateItem(0)
mail.Recipients.Add("email@gmail.com")
mail.Subject = "Subject here"
mail.Body = "Body here"
mail.Send();

 

License:  TIBCO BSD-Style License

Feedback (5)

you can add this for attachements

mail.Attachments.Add("C:/temp/viz.png")

navjeet_singh 2:49pm Aug. 07, 2019

Any chance of a version for the webplayer?

oliver.drummond 5:16pm Aug. 07, 2019

Anyone have a way to attach a file or embed an image with this?

Dan.Westphal 12:21pm Mar. 13, 2019

This is great, but are there any solutions that work in webplayer?

sarah.richards 8:22am Jan. 15, 2018

This is amazing. 

Rahul Kale 12:32pm Apr. 06, 2017