Jump to content
  • How to Send an Email in Spotfire® Using IronPython Scripting


    This article provides a sample script on how to send an email using IronPython scripting that works

    Introduction

    This article provides a sample script on how to send an email using IronPython scripting that works in both Spotfire Analyst and WebPlayer

    Code Sample

    # Copyright © 2019. TIBCO Software Inc. Licensed under TIBCO BSD-style license.
    
    # Here are the email package modules we'll need
    from email.mime.text import MIMEText
    from email.mime.multipart import MIMEMultipart
    import smtplib
    
    #specify the smtp client details
    SMTPClient = "smtpclient" # for example "mail.gmail.com";
    SMTPPort = 25;
    
    eMailfrom="fromEmail"
    eMailTo="toEmail"
    # Create the container (outer) email message.
    msg = MIMEMultipart()
    msg['Subject'] = "This my Email Subject"
    msg['From'] =eMailfrom
    msg['To'] = eMailTo
    msg.preamble = "This my Email Subject"
    eMailBody="This the text of the email body"
    body = MIMEText(eMailBody, "plain")
    msg.attach(body)
    
    # Send the email via our own SMTP server.
    s = smtplib.SMTP(SMTPClient)
    s.sendmail(eMailfrom, eMailTo, msg.as_string())
    s.quit()
     

    References

    License:  TIBCO BSD-Style License

    Back to IronPyton Scripting in Spotfire Examples


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...