Skip to main content

Sending emails from JupyterLab

Project description


A jupyterlab extension to email notebooks from the browser.

Build Status codecov PyPI PyPI npm


  • Inline notebook as email, with code
  • Inline notebook as email, without code
  • Send notebook as HTML attachment, with code
  • Send notebook as HTML attachment, without code
  • Send notebook as PDF attachment, with code
  • Send notebook as PDF attachment, without code
  • Attach output data as CSV, TSV, PDF, PNG, or Excel Spreadsheet


pip install jupyterlab_email
jupyter labextension install jupyterlab_email
jupyter serverextension enable --py jupyterlab_email

Adding templates

install the server extension, and add the following to

c.JupyterLabEmail.smtp_servers = [{'name': 'gmail',
                                   'domain': '',
                                   'username': '<YOUR USERNAME>',
                                   'smtp': '',
                                   'port': 465}]

Create email from notebook:

Use the function in jupyterlab_email._email

def make_email(path, model, from_, type='email', template='', code=False, subject='',
               also_attach='none', also_attach_pdf_template='', also_attach_html_template=''):
        path        : path to notebook
        model       : notebook itself (in case deployment strips outputs or
                      notebook not available except through ContentsManager)
        from_       : address to send the email from
        type        : type to convert notebook to
        template    : template to use when converting notebook
        code        : include input cells in notebook
        subject     : subject of email
        also_attach : also attach pdf/html/both

Attach dataframe as csv or spreadsheet

In jupyterlab_email.attachments

def attach(data, filename, type):

Modify jupyterlab_email.attachments.EXCEL_ENGINE to use a different excel writer (defaults to xlsxwriter)

Inline LaTeX

In jupyterlab_email.attachments

def latex(expression):
    import matplotlib.pyplot as plt
    fig, ax = plt.subplots(figsize=(10, 1))
    plt.text(0, 0.6, r'$%s$' % expression, fontsize=25)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterlab_email-0.2.4.tar.gz (208.7 kB view hashes)

Uploaded source

Built Distribution

jupyterlab_email-0.2.4-py2.py3-none-any.whl (60.8 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page